I'm starting a new project with Symfony2 and I'm not really sure which ORM to choose. I've heard some bad things about Doctrine2, especially when it comes to inheritance and DQL. It seems like Propel is back from the dead, but on the other hand, there's no warranty that it will last forever.
Do you have any advice ?
I can tell you Propel is the most suitable ORM to use with Symfony2. It works fine and no plan to stop activities on it. The Propel2 project is on its way to be better than Propel 1.6.x (which is ever really great).
Don't hesitate to use Propel, many users including Sensio Labs are using it !
Here is the Propel doc for Symfony2: http://www.propelorm.org/documentation/#working_with_symfony2
Note: There is a related topic on Stack Exchange: https://softwareengineering.stackexchange.com/questions/48760/should-i-choose-doctrine-2-or-propel-1-5-1-6-and-why/117078#117078
Some points I forgot:
Some points I like in Doctrine2:
The problem is not about Doctrine DBAL but more about Doctrine ORM. And Propel2 is on its way to improve the whole Propel 1.6.x code.
Oh, and I used Doctrine2 for a long time ;)
My personal choice is Doctrine 2 for a few reasons:
Conceptually, it's very easy to understand. Working with entities and the entity manager is simple. I love how entities don't need to extend any base model class (like in Doctrine 1).
It's sort of the standard ORM for Symfony2 right now. While it may not be officially 'endorsed' by Symfony2, it's what most people are using, and therefore there's a wealth of information for it online. The value of this is tremendous.
You mention that you've heard "bad things about Doctrine2" - it's important that you realize no ORM is going to be perfect. I've run into some problems with it, but as long as you think creatively, you can find a solution. Sometimes that solution means writing raw SQL, no matter what ORM purists might say. I haven't run into any situation where I regretted using Doctrine 2.
I spent a lot of time looking at Propel, but I just didn't like how it worked. That's not to say it's a poorly programmed library, but for me personally it wasn't a good fit. But since every developer is different, the best advice I can offer is that you look at the documentation and usage examples for both libraries. Since you're going to be the one using it, and not us, you need to pick the library you think you'll benefit the most from.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With