Archive for November 9th, 2011
“Order By” for Zend Db findDependentRowset()
Posted by Bricky in Programming on November 9, 2011
This is another one of those note-to-self style posts.
Design decisions on Zend Db’s “Zend_Db_Table_Row_Abstract” class prevent the inclusion of an ‘order by’ clause directly in the (incredibly useful) “findDependentRowset” function.
But you can pass in the order by clause indirectly through a select statement as follows.
What you want would be something like:
$depRows = $row->findDependentRowset('DEP_TABLE_NAME', /*order by=*/'SORT_ORDER ASC');
and you get this by doing the following:
$depTable = new DEP_TABLE_NAME();
$depRows = $row->findDependentRowset($depTable, null, $depTable->select()->order('SORT_ORDER ASC'));
Popularity: 2% [?]