我加入了这样的模型:
// /foo/lib/model/doctrine/PurchasedItemTable.class.php
public function retrievePurchased(Doctrine_Query $q)
{
$rootAlias = $q->getRootAlias($q);
$q->innerJoin($rootAlias.'.MainItem mi');
return $q;
}
另外,我已经在generator.yml和一列中定义了方法:
// generator.yml
config:
actions: ~
fields: ~
list:
table_method: retrievePurchased
display: [id, MainItem, created_at, updated_at]
显示正常,但不可排序。如何添加此功能?
答案 0 :(得分:1)
public function retrievePurchased(Doctrine_Query $q)
{
$rootAlias = $q->getRootAlias($q);
$q->innerJoin($rootAlias.'.MainItem mi');
$q->orderBy('mi.created_at');
return $q;
}