mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Different indexes in some iterations of a DQL query result #6002
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 @enumag on GitHub (Jun 28, 2018).
Bug Report
I have no idea if this was broken recently or have always been like that so I can't answer if it is a BC break or not.
Summary
Different indexes when iterating over a query.
Sadly I don't have the time to create a failing test case for this. I realize that you're unlikely to find and fix the bug based on this report unless you know the internals well enough to immediately know what's the problem. The bug is a low priority for me so I can't spend the time needed for a better report. Feel free to simply close this issue.
How to reproduce
I have a query like this:
Then I iterate over it like this:
Current behavior
In the loop above the
$rowhas different structure in some iterations.Sometimes it looks like this:
Other times it looks like this:
EDIT: And in one case it even looked like this:
Basically the entity is always at
$row[0][0]while the coalesce-sum field is sometimes in$row[0][1]and other times in$row[1][1].Expected behavior
The rows should always have the same structure but I'm not sure which structure is correct. Why are the values nested to the second level anyway? Personally I'd simply expect this: