In the White October office we use a programing framework called Symfony for some of our projects. It provides us with well erm a framework to develop our web applications, it gives us a standard way of dealing with web requests, keeping our code in a standard set of folders and lots of handy tools to speed up the development of applications.
One such tool is the Propel ORM which gives us objects to represent the tables we have in databases, it reduces the amount of SQL you have to write in an application to almost nil.
Sometimes however searching for information in a table can be a lot harder in Propel that it would be in SQL, you have to use “Criteria” objects and they are not as intuitive as they should be.
However François Zaninotto, one of the creators of the Symfony framework, has written a finder plugin for Propel Objects called sfPropelFinderPlugin which aims to make this process a lot easier and more intuitive.
// With Peer and Criteria
$c = new Criteria()
$c->add(ArticlePeer::TITLE, '%world', Criteria::LIKE);
$c->add(ArticlePeer::IS_PUBLISHED, true);
$c->addAscendingOrderByColumn(ArticlePeer::CREATED_AT);
$articles = ArticlePeer::doSelect($c);
// with sfPropelFinder
$articles = sfPropelFinder::from('Article')->whereTitle('like', '%world')->whereIsPublished(true)->orderByCreatedAt()->find();
If you use Propel outside of Symfony you can also use this plugin as it is standalone.
I like the quote from the wiki page.
“Think of sfPropelFinder as jQuery for Propel”