[eluser]callumd[/eluser]
Hi,
Just wondering if "models" should only be used for general database queries, and nothing else?
The CodeIgniter user manual gives what seems to be a peculiar example of a model:
function insert_entry()
{
$this->title = $_POST['title']; // please read the below note
$this->content = $_POST['content'];
$this->date = time();
$this->db->insert('entries', $this);
}
From what I am learning about MVC, it doesn't seem right that a model's functions should be accessing the $_POST variable - it should only be using values that get explicitly passed to it?
Shouldn't it be the Controller's responsibility to grab the values of $_POST['title'] and $_POST['content'], and then pass them to the function insert_entry()? Or am I not understanding something about what should go in a model?
Thanks.