DDC-2933: [GH-917] DDC-2931 #3650

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

Originally created by @doctrinebot on GitHub (Jan 24, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user @doctrinebot:

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

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

Message:

This is a hotfix for DDC-2931 ( #916 )

After some debugging, I found that the issue came from UnitOfWork#createEntity with #406 ([DCOM-96](http://www.doctrine-project.org/jira/browse/[DCOM-96]%28http://www.doctrine-project.org/jira/browse/DCOM-96%29)).

When initializing the proxy for $first (during the DDC2931User#getRank() call), the ORM attempts to fetch also $second again via ObjectHydrator#getEntity, but the hintdoctrine.refresh.entitycontains the initialized proxy, while the identifier passed down is the identifier of$second` (not a proxy).

UnitOfWork#createQuery does some comparisons and detects the fact that the two objects don't correspond, and therefore marks the entity as "to be detached" (since it thinks that the one in the "refresh" hint is the correct entity to load).

Originally created by @doctrinebot on GitHub (Jan 24, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of Ocramius: Url: https://github.com/doctrine/doctrine2/pull/917 Message: This is a hotfix for [DDC-2931](http://www.doctrine-project.org/jira/browse/DDC-2931) ( #916 ) > After some debugging, I found that the issue came from [`UnitOfWork#createEntity`](https://github.com/doctrine/doctrine2/blob/bba5ec27fbbe35224be48878a0c92827ef2f9733/lib/Doctrine/ORM/UnitOfWork.php#L2512-L2528) with #406 ([[DCOM-96](http://www.doctrine-project.org/jira/browse/DCOM-96)](http://www.doctrine-project.org/jira/browse/[DCOM-96]%28http://www.doctrine-project.org/jira/browse/DCOM-96%29)). > > When initializing the proxy for `$first` (during the `DDC2931User#getRank()` call), the ORM attempts to fetch also `$second` again via [`ObjectHydrator#getEntity`](https://github.com/doctrine/doctrine2/blob/bba5ec27fbbe35224be48878a0c92827ef2f9733/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php#L280)`, but the hint`doctrine.refresh.entity`contains the initialized proxy, while the identifier passed down is the identifier of`$second` (not a proxy). > > `UnitOfWork#createQuery` does some comparisons and detects the fact that the two objects don't correspond, and therefore marks the entity as "to be detached" (since it thinks that the one in the "refresh" hint is the correct entity to load).
admin added the Bug label 2026-01-22 14:24:40 +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#3650