KnpPaginatorBundle Filters Symfony 4.2+

I am trying to use KnpPaginatorBundle Filters but the examples and documentation is not enough I’ll be very grateful if you helpme.

Somebody know how to add multiple filters? actually I only can use one with the example:

{{ knp_pagination_filter(pagination, {
        'entity.type': 'Type',
    }) }}

but when I add another parameter form displays a menu option with the 2 parameters and I only can filter 1

{{ knp_pagination_filter(pagination, {
                'entity.type': 'Type',
                'entity.brand': 'Brand',
            }) }}

my final query string is:

?filterField=entity.type&filterValue=chainsaw

?filterField=entity.brand&filterValue=husqvarna

and I need a query string like this:

?filterField1=entity.type&filterValue1=chainsaw&filterField2=entity.brand&filterValue2=husqvarna

The final idea of this filters is more complex with a multi filter with same parameter for example select 2 different brands and more filters like type.

?filterField1=entity.type&filterValue1=chainsaw&filterField2=entity.brand&filterValue2=husqvarna&filterField2=entity.brand&filterValue2=oregon

Please if you know another filter bundle feel free to tell me I’ll be very grateful.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *