mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Paginator returns incorrect IDs in getIterator when a subquery WHERE is present #7566
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 @pkly on GitHub (Oct 30, 2025).
Bug Report
Observed on 3.5.2 as well, possibly before then.
Summary
We're using doctrine alongside EasyAdmin and we observed funky behavior when adding a complex filter on one of our views which then gets passed into Paginator.
The query in question can be mostly boiled down to something like this:
Generated DQL in Paginator:
Produced SQL on count query from Paginator:
Later produces incorrect ids, as only 1 id is expected, but 2 are returned, even though the subquery by itself is correct, I believe the error is caused by multiple columns being present in select for this query, while paginator only expects one. It seems like it's caused by
LimitSubqueryWalkeradding a second select statement (at least from what I checked)Current behavior
Incorrect IDs are returned by
Paginator(variable:$foundIdRowsingetIterator)Expected behavior
Correct IDs are returned.
How to reproduce
I'll try to provide a repository with example data and entities shortly if needed.