我目前正在使用 KNP Paginator 对结果进行分页。我得到序列化分页器对象并以下列形式获得响应:
"current_page_number": 1
"num_items_per_page": 5
"items": [5]
"total_count": 35
"paginator_options": {
"pageParameterName": "page"
"sortFieldParameterName": "sort"
"sortDirectionParameterName": "direction"
"filterFieldParameterName": "filterField"
"filterValueParameterName": "filterValue"
"distinct": true
}-
"custom_parameters": [0]
"route": "api_tags_list"
"params": [0]
"page_range": 5
"template": "KnpPaginatorBundle:Pagination:sliding.html.twig"
"sortable_template":
"KnpPaginatorBundle:Pagination:sortable_link.html.twig"
"filtration_template":
"KnpPaginatorBundle:Pagination:filtration.html.twig"
是否可以覆盖 KNP 分页器实体,以便响应不包含templates
但包含total number of pages
?
期望的输出:
"current_page_number": 1
"num_items_per_page": 5
"items": [5]
"total_count": 35
"paginator_options": {
"pageParameterName": "page"
"sortFieldParameterName": "sort"
"sortDirectionParameterName": "direction"
"filterFieldParameterName": "filterField"
"filterValueParameterName": "filterValue"
"distinct": true
}-
"custom_parameters": [0]
"route": "api_tags_list"
"params": [0]
"page_range": 5
"total_page_number": 7