CodeIgniter Forums

Full Version: Codeigniter with an ORM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Dennis_gull[/eluser]
Hi,

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) ?

El Forum

[eluser]dmorin[/eluser]
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 (http://www.doctrine-project.org/document...validation) which is integrated into the model by default.

El Forum

[eluser]Dennis_gull[/eluser]
Thanks, I will definitely look in to the doctrine validation.