Codeigniter with an ORM


I read a blog about Codeigniter combined with Doctrine. I've been interested to do something like this for quite some time now as you will not only get a better structure but also have built in support for APC, memcached and so on..

However I have a question about the implementation from the tutorial, I already posted the question as a comment on his blog entry but I would like to hear what you guys think... heres the question:

I’ve been working with CI for almost a year now and from my experience I always keep the controller clean and instead run validations and so on in the model, after all I think the logic should be there.

Now if I would switch to doctrine, It seems wrong to put the validation in the doctrine class, as doctrine is just for the so called “object relational mapping”.

What do you think about this, should I put the logic in the doctrine class or should I put it in the controller.. or should I keep the model and use doctrine separately (sounds messy) ?

You can definitely make the case for why validation would be in the doctrine model so that you can type it in with the model's callbacks/listeners and validate automatically on insert and update. One think you may want to look into is using Doctrine's validation instead of CI's ( which is integrated into the model by default.

Thanks, I will definitely look in to the doctrine validation.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.