是否可以在魔术方法db结果中添加ORDER BY子句。来自文档:
$accountsTable = new Accounts();
$accountsRowset = $accountsTable->find(1234);
$user1234 = $accountsRowset->current();
// Use the default reference rule
// is it possible to add an order to the related tables results?
$bugsReportedBy = $user1234->findBugs();
// Specify the reference rule
$bugsAssignedTo = $user1234->findBugsByEngineer();
答案 0 :(得分:1)
有点试错,我可以添加ORDER BY子句。您可以传入Zend_Db_Select
$bugsTable = new Bugs() //extends Zend_Db_Table_Abstract;
$bugsSelect = $bugsTable->select();
$bugsSelect->order('name ASC');
$bugsReportedBy = $user1234->findBugs($bugsSelect);