You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using this DQL at two places in our application. Both use the same filters (specifications). The first one works as expected and returns the important parts:
SELECTb0_.idAS id_0, b0_.dateAS date_1, ...
WHEREb0_.compartment_id= ? AND (c6_.id= ? AND (b0_.date>= ? ANDb0_.date<= ?) ANDl3_.id= ? ANDp2_.id= ?)
GROUP BYb0_.date, b0_.shippingnumber, p2_.id, l3_.idORDER BYb0_.dateDESC, p2_.integrator_numberASC
We are using the default paginator option with use-distinct set to true. The COUNT of the paginator works fine and returns the correct result using DISTINCT:
SELECTcount(DISTINCT b0_.id)
Unfortunately we don't get any results from this correctly counted rows. The responsible query will look like this:
SELECT DISTINCTb0_.idAS id_0...
And this will result in the following original query with the extra IN condition for selecting the found IDs:
SELECTb0_.idAS id_0, b0_.dateAS date_1, ...
WHERE ...
ANDb0_.idIN (?)
GROUP BYb0_.date, b0_.shippingnumber, p2_.id, l3_.idORDER BYb0_.dateDESC, p2_.integrator_numberASC
The issue is caused by the DISTINCT on the SELECT. Without it the query will work fine.
We tried to disable it but this will only remove DISTINCT on the COUNT query.
We need the DISTINCT removed on the SELECT IDs query.
Is (/ should) this (be) possible?
P.S.: We are using a mixed result but the (Doctrine) Pagniator seems to have no problem with it until we enable wrap-queries. That would return Not all identifier properties can be found in the ResultSetMapping: id. Maybe this is important to know too.
Hello sorry for the late response! Have you solved your issue? Under the hood we use Doctrine paginator, so it may be an issue with the Doctrine\ORM\Tools\Pagination\Paginator.
It look to me that the DISTINCT part of your query is important because you have JOINs and you may get the wrong number of result.
We fixed some issues about GROUP BY since your issue you may give a try to the last version of the bundle.
We have refactored our codebase and another developer was involved. I will ask him in October if we still use the query and try the latest version. Thanks!
We are using a rather complicated query with a lot of grouping. I will break it down to most interesting parts:
We are using this DQL at two places in our application. Both use the same filters (specifications). The first one works as expected and returns the important parts:
We are using the default paginator option with
use-distinct
set totrue
. TheCOUNT
of the paginator works fine and returns the correct result usingDISTINCT
:Unfortunately we don't get any results from this correctly counted rows. The responsible query will look like this:
And this will result in the following original query with the extra
IN
condition for selecting the found IDs:Parameters: [1, 6408, '2015-07-30', '2016-07-06', 4, 13295, ['0']]
The issue is caused by the
DISTINCT
on theSELECT
. Without it the query will work fine.We tried to disable it but this will only remove
DISTINCT
on theCOUNT
query.We need the
DISTINCT
removed on theSELECT
IDs query.Is (/ should) this (be) possible?
P.S.: We are using a mixed result but the (Doctrine) Pagniator seems to have no problem with it until we enable
wrap-queries
. That would return Not all identifier properties can be found in the ResultSetMapping: id. Maybe this is important to know too.Possibly related:
The text was updated successfully, but these errors were encountered: