Propel ORM を使用する Symfony2 プロジェクトで、KNP Paginator バンドルを使用してリスト ビューを列で並べ替えようとしています。私のコードは次のとおりです。
public function indexAction()
{
$query = CustomerQuery::create();
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate($query, $this->get('request')->query->get('page', 1), 30);
return compact('pagination');
}
そして私の見解は次のとおりです。
<table>
<thead>
<tr>
<th>{{ pagination.sortable('Company', 'companyName')|raw }}</th>
<th>{{ pagination.sortable('Contact', 'contact')|raw }}</th>
<th>{{ pagination.sortable('E-mail', 'email')|raw }}</th>
</tr>
</thead>
<tbody>
{% for customer in pagination %}
<!-- [...] -->
{% endfor %}
</tbody>
</table>
私が得たように、生成されたリンクは正しいようです(たとえば):
/customers/?sort=companyName&direction=asc&page=1
しかし、クエリはソートされません。生成されたリクエストにはORDER BY句がありません。それで、私の質問は: 結果の順序付けは Propel で利用できますか (もしそうなら、どこが間違っていますか)? または、コントローラーで手動で処理する必要がありますか?