Blog

Symfony: Propel VS Doctrine

Aug 31, 2009
Category:Symfony Programming 

A few days ago I started using Symfony. I chose to use Propel as the ORM. The ORM generates the PHP classes and database structure from your schema.

When I stared using Propel in PHP, it looked amazing, each db table has a php class representing it, with methods generated to set and get the fields, and also to allow you to fetch foreign tables. The propel query class offers a way to join and select from your database that returns these objects. As everything is represented as automatically built classes, any good IDE will offer autocomplete with all you table and field names! :D Not to mention the SQL manipulation methods too!

However not far into it I discovered a problem, and quite a big one at that!! Turns out there is a long standing bug and kinda makes Propel suck.

Time to try Doctrine then...

Very similar to Propel in what it does, but generates quite a different class structure. Auto complete does not work because of the 'magic' methods it defines, and the way it chains commands together confuses my IDE (and me) about which object has been returned after each successive command.

However, it handles the situation that Peopel failed at quite gracefully and looks like it is much more flexible and powerful when it comes to complex SQL.

Its just a shame I'm having to spend ages referring to the manual and searching Google when autocomplete would have instantly showed me the command I needed. Yet another mountain added to the learning curve, but despite that it looks like Doctrine wins for its bug free (so far) and powerful SQL methods.

A couple of resources I found:

http://redotheweb.com/2008/07/08/comparing-propel-doctrine-and-sfpropelfinder/

http://codeutopia.net/blog/2008/03/02/doctrine-vs-propel/


Comments