DDC-1842: [GH-359] Hydrator hotfix - parent object association #2320

Open
opened 2026-01-22 13:48:24 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (May 27, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of splitin2:

Url: https://github.com/doctrine/doctrine2/pull/359

Message:

Found that using a mixed sql and more than 2 entities the hydrator skips one related association and inserts the third related entity wrongly.

In the case below "c" will be inserted into "a"

SELECT SUM(a.sold) as total, a, b, c FROM Entity\A a LEFT JOIN a.test1 b LEFT JOIN b.test2 c GROUP BY a.id

On a later flush call this will result in ORM\Exception

Found entity of type Entity\A on association Entity\C#test2, but expecting Entity\B
Originally created by @doctrinebot on GitHub (May 27, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: This issue is created automatically through a Github pull request on behalf of splitin2: Url: https://github.com/doctrine/doctrine2/pull/359 Message: Found that using a mixed sql and more than 2 entities the hydrator skips one related association and inserts the third related entity wrongly. In the case below "c" will be inserted into "a" <code>SELECT SUM(a.sold) as total, a, b, c FROM Entity\A a LEFT JOIN a.test1 b LEFT JOIN b.test2 c GROUP BY a.id</code> On a later flush call this will result in ORM\Exception <pre> Found entity of type Entity\A on association Entity\C#test2, but expecting Entity\B </pre>
admin added the Bug label 2026-01-22 13:48:24 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2320