mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[Bug] ORDER BY and LIMIT using subqueries #5960
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @joshlopes on GitHub (May 2, 2018).
Hello!
I'm trying to upgrade 2.4.8 to 2.5.14 and i've been having some issues using ORDER BY and LIMIT using 1 to Many JOINs.
The follow query will run normally in my mysql client:
producthas a 1 to many relation withproduct_translationsand this works fine on 2.4 and below from 2.5 everytime i try to run that same query i get aThis was a change done as part of this PR: https://github.com/doctrine/doctrine2/pull/1353 more precisely this file:
608dfa2f57 (diff-e7afd03e36cf8d3fe30efd893375da43)Looking around i'm not sure, but i thin KNP Paginator is even using the old one: https://github.com/KnpLabs/knp-components/blob/master/src/Knp/Component/Pager/Event/Subscriber/Paginate/Doctrine/ORM/Query/LimitSubqueryWalker.php as a work around for the issue.
@stollr commented on GitHub (Oct 18, 2018):
Why do you need the
distinct? TheGROUP BYalready results in one row per product.Changing the
SELECT distinct(p.id)toSELECT p.idshould give you the same result.@joshlopes commented on GitHub (Oct 19, 2018):
@naitsirch yes you are right - although the problem has nothing to do with distinct i think. It's with LIMIT and ORDER.