简体   繁体   中英

How do I add query params to pagerfanta paginator with symfony 4?

I'm using pagerfanta with symfony 4. I'm paginating DoctrineORM results with pagerfanta.

I want to paginate search results, without query params it's all working great :

{{ pagerfanta(articles, 'twitter_bootstrap4_translated', {routeName: 'articles_paginated'}) }}

I have urls looking like this :

http://host/articles/page/1

How do I add a param in the view so that the generated urls include some parameters, for example :

http://host/articles/published/1/page/1

Or :

http://host/articles/page/1?published=1

Use routeParams :

    {{ pagerfanta(articles, 'twitter_bootstrap4_translated', 
        {
            'routeName': 'articles_paginated',
            'routeParams': {},
        }
    ) }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM