私はknp paginatorを使用していますが、うまく機能しますが、ソート機能を使用したい場合、小枝でソート方向を取得するのに問題があります。
次のコードは、ソートされたテーブル ヘッダーを取得する方法を示していますが、ソートされたテーブル ヘッダーの方向を取得する方法については考慮していません。
{# total items count #}
<div class="count">
{{ pagination.getTotalItemCount }}
</div>
<table>
<tr>
{# sorting of properties based on query components #}
<th>{{ knp_pagination_sortable(pagination, 'Id', 'a.id') }}</th>
<th{% if pagination.isSorted('a.Title') %} class="sorted"{% endif %}>{{ knp_pagination_sortable(pagination, 'Title', 'a.title') }}</th>
</tr>
{# table body #}
{% for article in pagination %}
<tr {% if loop.index is odd %}class="color"{% endif %}>
<td>{{ article.id }}</td>
<td>{{ article.title }}</td>
</tr>
{% endfor %}
</table>
{# display navigation #}
<div class="navigation">
{{ knp_pagination_render(pagination) }}
</div>
このコードは、次のリンクの KnpPaginator ドキュメントから取得します: https://github.com/KnpLabs/KnpPaginatorBundle