I use this bundle in symfony 4, my filtering code looks like this
{{ knp_pagination_filter(paginator, {
't.code': 'Code'
}) }}
as well as my settings file in the /conf/ directory
knp_paginator:
page_range: 5 # default page range used in pagination control
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_value_name: filterValue
template:
pagination: '@KnpPaginator/Pagination/twitter_bootstrap_v4_pagination.html.twig'
sortable: '@KnpPaginator/Pagination/sortable_link.html.twig' # sort link template
filtration: '@KnpPaginator/Pagination/filtration.html.twig' # filters template
No one faced with the fact that filtering is very rigidly tied to the value of the filter? for example: And the base has the values "AppleJuice" and "Apple" when typing in the filter field "Apple", I do not see the value "AppleJuice", only "Apple"
where I can set the filter type WHERE '%' + LOWER (param) + '%' LIKE LOWER (item.code)
Exit, write your SQL query in your table service file