A while ago I created my own MVC to learn about this pattern and to do some practice. Now, I want to start using an orm in my MVC. However, I'm not quite sure how to accomplish this.
As for now, the only thing my controllers do is pass and retrieve data and that's it. Performing crud operations is the job of the models.
$controller->$model->getUsers();
However, when looking into some documentation at for example Symfony, I see they directly communicate with the ORM (Doctrine) in the controller.
public function createAction()
{
$job = new Job();
$job->setPosition('Web developer');
// .. set other fields
// get the entity manager
$em = $this->get('doctrine.orm.entity_manager');
// persist the object to database
$em->persist($job);
$em->flush();
// ...
}
Also for CodeIgniter a tutorial shows that is has been used in the Controller: http://talkweb.eu/how-to-run-doctrine-orm-with-codeigniter/
Why is that? Now you are doing a lot in your controller that should not be there at all I think, why not create a function in the model to call in your controller like
$this->model->addJob("web developer");
or something...