You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Doctrine fetches the entities for a PersistentCollection it overwrites the programmatically set null values in association fields for already managed (in the identity map) entities.
if (! $reflFieldValue || isset($this->hints[Query::HINT_REFRESH]) || $this->uow->isUninitializedObject($reflFieldValue)) {
.
Current behavior
The association field, which was just set to null by code, is overwritten with the persisted peer entity.
How to reproduce
In the following example there is a one-to-one association. One side gets set to null, but when a collection containing the entity is loaded, the field is restored with the peer entity.
If an entity is already managed (in the identity map) Doctrine should not change the fields when fetching the database records for a PersistentCollection.
The text was updated successfully, but these errors were encountered:
Bug Report
Summary
When Doctrine fetches the entities for a PersistentCollection it overwrites the programmatically set null values in association fields for already managed (in the identity map) entities.
This happens by the if statement in
orm/src/Internal/Hydration/ObjectHydrator.php
Line 434 in 205b2f5
Current behavior
The association field, which was just set to null by code, is overwritten with the persisted peer entity.
How to reproduce
In the following example there is a one-to-one association. One side gets set to null, but when a collection containing the entity is loaded, the field is restored with the peer entity.
https://github.com/insel-maz/doctrine-bug-collection-initialization-overwrites-field
Expected behavior
If an entity is already managed (in the identity map) Doctrine should not change the fields when fetching the database records for a PersistentCollection.
The text was updated successfully, but these errors were encountered: