CodeIgniter + Doctrine: CRUD in Controller? CodeIgniter + Doctrine: CRUD in Controller? codeigniter codeigniter

CodeIgniter + Doctrine: CRUD in Controller?


If you don't want to write the DQL into the Controller (which is a good thing) you can put separate functions into your model that just work with the functionality provided by the extended classes.

For example, if you have a class called User, and you need to save it, you simple could do

class User extends BaseUser //or whatever you want{    public function saveNewUser($data) {        //setting the userdata e.g. $this->username        try {            $this->save();            ....        } catch (Doctrine_Connection_Mysql_Exception $e) {           ...        }    }}

So you have all functions inside the model just as you wanted it.