Order By On findManyToManyRowset method for Zend Framework
Feb 19th, 2008
Select statements (via Zend_Db_Table_Select) can now be passed into the findManyToManyRowset method of Zend_Db_Table_Row_Abstract. In ZF 1.0, I couldn't order my result sets coming back from MySQL, which was a pain. Now, I can use the following code, where $m is a Row object:
[php]
$select = $m->select()->order(array('startDate DESC','endDate ASC'));
$tripreportRowset = $m->findManyToManyRowset('Tripreport', 'TripreportMountain',NULL,NULL,$select);
[/php]
If you don't need to order by multiple columns, then don't pass an array...
Posted In: PHP, Zend Framework
Commentary
zsolt 2010-01-05 17:34:34
Thank you for your article, it help me. I am beginner in ZF, but very agile, because I have to refactor a webportal into Zend Framework. :) By, Zsolt (from Hungary)
Anonymous 2011-09-23 13:37:57
Thanks, this helped me a lot. My documentation didn't explain the $select parameter at all.