mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3091: Not set entity to results if use query with JOIN #3834
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 @doctrinebot on GitHub (Apr 17, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user zhukv:
Hi.
I have a problem, if i can use query with *JOIN* without grouping (DISTINCT) by identifier entity. Problem: not set entities to result, if entity has cached in ObjectHydration.
For example:
SQL query:
Mysql result:
{quote}
| id0 | hash1 | mii2 | iin3 | last_digits4 | number5 | holder6 | keyword7 | client8 | sclr9 |
| 28 | 1d741fd06f3315dad28039926effc5d7 | 5 | 533330 | 2763 | 533330*******2763 | John Doe | p6 | 78165 | 1d741fd06f3315dad28039926effc5d7p678165 |
| 34 | 58b021876f625e3000137cd835f5fe40 | 5 | 555456 | 5047 | 555456**5047 | OLOLO OLOLO | p6 | 78165 | 58b021876f625e3000137cd835f5fe40p678165 |
| 2 | 887d30e9b4d18676c6e0dc8e21e36d28 | 5 | 556458 | 4251 | 556458**4251 | Monkey Testing | p6 | 78165 | 887d30e9b4d18676c6e0dc8e21e36d28p678165 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 100673 | bb14a77f2e363cd144b669f0b594d304p6100673 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 100922 | bb14a77f2e363cd144b669f0b594d304p6100922 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 101441 | bb14a77f2e363cd144b669f0b594d304p6101441 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 78165 | bb14a77f2e363cd144b669f0b594d304p678165 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 85550 | bb14a77f2e363cd144b669f0b594d304p685550 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114**1118 | Monkey Testing | p6 | 85566 | bb14a77f2e363cd144b669f0b594d304p685566 |
| 1 | bb14a77f2e363cd144b669f0b594d304 | 4 | 432114 | 1118 | 432114*******1118 | Monkey Testing | p6 | 85768 | bb14a77f2e363cd144b669f0b594d304p685768 |
{quote}
And the PHP code (from custom entity repository):
And this code returned only unique entities by identifier (Identifier: id field), but must returned the all entities from query.
The Object Hyndration has cached created entities, and if the next row is entity (indicate as identifier and dql alias), then hydration not set this entity to result.
Problem code: https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L569-L572
Thank.