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

Closed
opened 2026-01-22 14:24:43 +01:00 by admin · 4 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:43 +01:00
admin closed this issue 2026-01-22 14:24:43 +01:00
Author
Owner
@doctrinebot commented on GitHub (Jan 24, 2014): - relates to [DDC-2931: OneToOne self-referencing fails when loading referenced objects](http://www.doctrine-project.org/jira/browse/DDC-2931) - relates to [DDC-2932: [GH-916] [DDC-2931] testcase to reproduce Jira 2931](http://www.doctrine-project.org/jira/browse/DDC-2932)
Author
Owner

@doctrinebot commented on GitHub (Feb 6, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-916] was closed:
https://github.com/doctrine/doctrine2/pull/916

@doctrinebot commented on GitHub (Feb 6, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-916] was closed: https://github.com/doctrine/doctrine2/pull/916
Author
Owner

@doctrinebot commented on GitHub (Feb 8, 2014):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-917] was closed:
https://github.com/doctrine/doctrine2/pull/917

@doctrinebot commented on GitHub (Feb 8, 2014): Comment created by @doctrinebot: A related Github Pull-Request [GH-917] was closed: https://github.com/doctrine/doctrine2/pull/917
Author
Owner

@doctrinebot commented on GitHub (Feb 8, 2014):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Feb 8, 2014): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3651