Tag Archives: custom query

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