Welcome Guest, Not a member yet? Register   Sign In
Is it okay/advisable to use input methods directly in models?
#1

[eluser]robnecciai[/eluser]
New to CI. I'm building a rather large site and, while I'm laying the groundwork, I have discovered that there are many posts on this forum that show example of using input->post methods directly within data models. Is this "best practices"?

example (in a data model):

function insert()
{
$data = array('userName' => $this->input->post('username'), 'age' => $this->input->post('age'));
$this->db->insert('member', $data);
}

If this is okay, can I also assume that it would be ok to traverse the input->post() array and "dynamically" build the data array to pass to the db->insert function?

I'm just looking for a good, solid, and fairly generic pattern for performing these actions.


Messages In This Thread
Is it okay/advisable to use input methods directly in models? - by El Forum - 10-19-2010, 10:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB