-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CreateQuery and searchAction have conflict #5569
CreateQuery and searchAction have conflict #5569
Comments
Can someone confirm this ? Is it a real bug or am I doing something wrong ? We need to implement the searchAction at our company and we wonder if we will have to reimplement the page. Thanks for the help. |
I can't reproduce the issue. The conditions added at |
Hi @phansys ! I made this : https://github.com/VincentLanglet/sonataBug |
Have you tested the behavior updating the query to something more explicit? $query
->andWhere($query->expr()->like("$o.firstName", ':firstName'))
->setParameter('firstName', '%Jean%'); Also, please take into account that the query you've shared is referencing a column named |
@phansys I made a typo in the query shared. My table was I tried your example
|
After some debug, I can confirm what you are experiencing.
SonataAdminBundle/src/Datagrid/Datagrid.php Line 144 in 64b83e2
By now, the only approach I can think to solve this issue is defining the grouping "AND" expression at the datagrid and passing it to each filter in order to stack the "OR" clauses inside the same group, but I don't know how to achieve this without changing |
@phansys I agree with your analysis. How would you modify the Thanks |
This issue is a duplicate of #3368. |
Indeed ! |
Environment
Sonata packages
Symfony packages
PHP version
Subject
I use the
createQuery
function to limiting entities in the list (here). I recently used the sonata search bar and I was expected thecreateQuery
used in the search to filter the possible results found. But the way thecreateQuery
just makes the search bar useless. Instead of looking for my research and then filtering with thecreateQuery
, the search action is looking for all entities matching with my research OR thecreateQuery
, so it returns all the entities I can see in the list...Steps to reproduce
createQuery
createQuery
Expected results
The request used in the search action should be
Actual results
In fact the request is the following, so the search return all possible result in the list...
The text was updated successfully, but these errors were encountered: