Initial thoughts on Doctrine

I started to use Doctrine this year, and I have to say that I think I prefer it over Propel now on how you construct queries. The syntax is a little cleaner as well in my opinion. Here is an example of both syntaxes to retrieve a set of articles from a database which match a few criteria.


$criteria = new Criteria('article a');
$criteria->add('a.status', 'active');
$criteria->add('a.type', 'news');


$query = new Doctrine_Query::create()
       ->from('article a')
       ->where('a.status = ?', 'active')
       ->andWhere('a.type = ?', 'news')
       ->addOrderBy(' DESC');

I also find the Doctrine way or building the query easier to read compared to the Propel one.

Once I’ve worked with Doctrine some more, and built some more complex queries I’ll add some more thoughts.