Reputation: 4450
If I use an ORM let's say with Zend or Symfony. Is it an all or nothing deal?
I'd like to use the ORM, but also want to optimize performance in some cases and write the query myself to get to the nitty gritty. So if I start using an ORM, is it going to be difficult to do it the old way once I include it in my project?
Upvotes: 8
Views: 462
Reputation: 5307
You can mix and match all you like. The main risk is introducing incompatible inconsistencies between your tools. Hypothetical Ex:
if I have a doctrine2 ORM entity called a User and I use Zend_Db_Table to change some values between flushes on the users table, I may have some inadvertent side effects or undesired behaviour.
Upvotes: 0
Reputation: 10403
Using Doctrine it is fairly easy to "break out" of the ORM. Doctrine lets you write queries in 4 different ways:
If you're using Doctrine inside of Symfony, there are absolutely no features of Symfony that lock you into using Doctrine, even if it's enabled.
One final warning: if you're using some of Doctrine's advanced features (e.g. events or behaviors) these will become difficult to tie in when you do queries outside of DQL.
Upvotes: 6