gpt4 book ai didi

symfony - 如何为 Symfony 4 配置 KnpPaginatorBundle

转载 作者:行者123 更新时间:2023-12-01 12:11:50 24 4
gpt4 key购买 nike

我希望在 symfony4 中实现 KnpPaginatorBundle。

我的问题是,在他们的文档(适用于 S3)中,他们建议使用以下参数 i config.yml。

knp_paginator:
page_range: 5 # number of links showed in the pagination menu (e.g: you have 10 pages, a page_range of 3, on the 5th page you'll see links to page 4, 5, 6)
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
sort_direction_name: direction # sort direction query parameter name
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
filter_field_name: filterField # filter field query parameter name
filter_value_name: filterValue # filter value query parameter name
template:
pagination: '@KnpPaginator/Pagination/sliding.html.twig' # sliding pagination controls template
sortable: '@KnpPaginator/Pagination/sortable_link.html.twig' # sort link template
filtration: '@KnpPaginator/Pagination/filtration.html.twig' # filters template

我不确定在哪里使用这些参数,因为 S4 没有 config.yml 文件。
我找不到任何关于 KNP Bundle 和 S4 的文档。任何帮助深表感谢!谢谢!

最佳答案

关注问题here在讨论 symfony4 问题的地方,配置似乎是一样的:

他将配置放在“config/packages/paginator.yaml”中

# config/packages/paginator.yaml
knp_paginator:
page_range: 5 # number of links showed in the pagination menu (e.g: you have 10 pages, a page_range of 3, on the 5th page you'll see links to page 4, 5, 6)
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
sort_direction_name: direction # sort direction query parameter name
distinct: true # ensure distinct results, useful when ORM queries are using GROUP BY statements
filter_field_name: filterField # filter field query parameter name
filter_value_name: filterValue # filter value query paameter name
template:
pagination: '@KnpPaginator/Pagination/sliding.html.twig' # sliding pagination controls template
sortable: '@KnpPaginator/Pagination/sortable_link.html.twig' # sort link template
filtration: '@KnpPaginator/Pagination/filtration.html.twig' # filters template

关于symfony - 如何为 Symfony 4 配置 KnpPaginatorBundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51187699/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com