Tag Archives: sfPropelCustomSelectPlugin

sfPropelCustomSelectPlugin sample usage

This article has moved to this location.

A few days ago, i’ve made sfPropelCustomSelectPlugin, a plugin that allow to select arbitrary columns without loosing the power of Propel ORM. In this article, i would like to show you how to use the plugin in your application. This plugin was designed to work well with doSelect, doSelectJoinXXX functions and sfPropelPager class. If you are using propel 1.5 you can using ModelCriteria::select() and ModelCriteria::withColumn() together to achieve the same result (http://www.propelorm.org/ticket/1172).
I assume that you have already installed the plugin correctly.
Read More


Selecting arbitrary┬ácolumns using propel

Generally we cannot use hydrate() with a query where we specify our own select columns. Propel always assumes that statements passed to hydrate() contain the full properties for the object. But of course we can still get the object(s) by populating the statements manually.

while ($row = $stmt->fetch (PDO::FETCH_NUM))
   $myClass = new myClass();
   $myClasses[] = $myClass;
return $myClasses;

But the problem will arise when we are working with sfPropelPager, because sfPropelPager only works with Object.
So, how to return the propel object(s) when we want to select only a few columns?. In this article, i would like to share my idea how to solve the problem stated above.
Read More