将添加的字段排序到管理生成器列表

时间:2011-10-20 10:07:50

标签: symfony1 symfony-1.4

我加入了这样的模型:

// /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]

显示正常,但不可排序。如何添加此功能?

1 个答案:

答案 0 :(得分:1)

public function retrievePurchased(Doctrine_Query $q)
{
    $rootAlias = $q->getRootAlias($q);
    $q->innerJoin($rootAlias.'.MainItem mi');
    $q->orderBy('mi.created_at');
    return $q;
}