Which ORM to use with Symfony2? [closed] Which ORM to use with Symfony2? [closed] symfony symfony

Which ORM to use with Symfony2? [closed]


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:

  • Behaviors are part of Propel, no one provided in Doctrine2. That means Propel officially supports them and provides support/improvements. Not sure about Doctrine ones.
  • Propel is really fast. I agree Doctrine2 is better than Propel for mass insertions.
  • Propel is 10 years old, stable and used by a lot of people.
  • No yet another language to learn with Propel.
  • Propel2 is really object oriented, thanks to fluent APIs.
  • Doctrine2 ORM doesn't share the same API with ODM, so you may use Propel with D2 ODM like D2 ORM and ODM, there are no pros here.
  • Propel uses code generation for specific platforms, so it's optimized for your needs, and fast thanks to runtime & generator parts.

Some points I like in Doctrine2:

  • Annotations.
  • The whole code because it's quite recent.

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.


I can tell you Propel is the most suitable ORM to use with Symfony2 I should disagree. Doctrine2 is a native ORM for Symfony. It is contained in standard Symfony distribution available here: http://symfony.com/download

Symfony documentation describes working with Doctrine mostly, not Propel. So, I don't think Propel choice is too obvious. I think you should really weight the consequences. I'd prefer Doctrine.

Here is a list of options, supported by Propel bundle: http://www.propelorm.org/cookbook/symfony2/working-with-symfony2.html