This issue is created automatically through a Github pull request on behalf of Ocramius:
This is a hotfix for
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 (
> 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).