omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
251 stars 113 forks source link

Not case-sensitive search for postgresql in symfony 5.2 #221

Closed AntonA46 closed 3 years ago

AntonA46 commented 3 years ago

Hello! Table searches are performed using the "LIKE" operator, which is case sensitive in postgresql. In MYSQL There is no such problem. How fix this problem ?

AntonA46 commented 3 years ago

Decision: Need to use SearchCriteriaProvider in ORMAdapter. In my case:

'criteria' => [
function (QueryBuilder $ queryBuilder, DataTableState $ state) {
$ state-> setGlobalSearch (mb_strtoupper ($ state-> getGlobalSearch ()));
},
new SearchCriteriaProvider (),].

In the dataTable constructor, in the added columns, add

'field' => 'upper (u.name)',
'searchable' => true,