Should I choose Doctrine 2 or Propel 1.5/1.6, and why?
- by Billy ONeal
I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus Propel 1.3/1.4, and both ORMs went through significant redesigns in their recent revisions. For example, most of the criticism of Propel seems to center around the "ModelName Peer" classes, which are deprecated in 1.5 in any case.
Here's what I've accumulated so far (And I've tried to make this list as balanced as possible...):
Propel
Pros
Extremely IDE friendly, because actual code is generated, instead of relying on PHP magic methods. This means IDE features like code completion are actually helpful.
Fast (In terms of database usage -- no runtime introspection is done on the database)
Clean migration between schema versions (at least in the 1.6 beta)
Can generate PHP 5.3 models (i.e. namespaces)
Easy to chain a lot of things into a single database query with things like useXxx methods. (See the "code completion" video above)
Cons
Requires an extra build step, namely building the model classes.
Generated code needs rebuilt whenever Propel version is changed, a setting is changed, or the schema changes. This might be unintuitive to some and custom methods applied to the model are lost. (I think?)
Some useful features (i.e. version behavior, schema migrations) are in beta status.
Doctrine
Pros
More popular
Doctrine Query Language can express potentially more complicated relationships between data than easily possible with Propel's ActiveRecord strategy.
Easier to add reusable behaviors when compared with Propel.
DocBlock based commenting for building the schema is embedded in the actual PHP instead of a separate XML file.
Uses PHP 5.3 Namespaces everywhere
Cons
Requires learning an entirely new programming language (Doctrine Query Language)
Implemented in terms of "magic methods" in several places, making IDE autocomplete worthless.
Requires database introspection and thus is slightly slower than Propel by default; caching can remove this but the caching adds considerable complexity.
Fewer behaviors are included in the core codebase. Several features Propel provides out of the box (such as Nested Set) are available only through extensions.
Freakin' HUGE :)
This I have gleaned though only through reading the documentation available for both tools -- I've not actually built anything yet.
I'd like to hear from those who have used both tools though, to share their experience on pros/cons of each library, and what their recommendation is at this point :)