[PR #917] DDC-2931 - one-to-one self-referencing association broken by DCOM-96 #8896

Closed
opened 2026-01-22 16:02:12 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/917

State: closed
Merged: Yes


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

Background

After some debugging, I found that the issue came from UnitOfWork#createEntity with #406 (DCOM-96).

When initializing the proxy for $first (during the DDC2931User#getRank() call), the ORM attempts to fetch also $second again via ObjectHydrator#getEntity, 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).

**Original Pull Request:** https://github.com/doctrine/orm/pull/917 **State:** closed **Merged:** Yes --- This is a hotfix for DDC-2931 ( #916 ) ### Background > 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)). > > 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 pull-request label 2026-01-22 16:02:12 +01:00
admin closed this issue 2026-01-22 16:02:12 +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#8896