Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Aug 6, 2023
1 parent fbb11c3 commit 66c4c76
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -3048,6 +3048,7 @@ public function createEntity($className, array $data, &$hints = [])
// We are negating the condition here. Other cases will assume it is valid!
case $hints['fetchMode'][$class->name][$field] !== ClassMetadata::FETCH_EAGER:
$newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'], $normalizedAssociatedId);
$this->registerManaged($newValue, $associatedId, []);
break;

// Deferred eager load only works for single identifier classes
Expand All @@ -3056,20 +3057,14 @@ public function createEntity($className, array $data, &$hints = [])
$this->eagerLoadingEntities[$targetClass->rootEntityName][$relatedIdHash] = current($normalizedAssociatedId);

$newValue = $this->em->getProxyFactory()->getProxy($assoc['targetEntity'], $normalizedAssociatedId);
$this->registerManaged($newValue, $associatedId, []);
break;

default:
// TODO: This is very imperformant, ignore it?
$newValue = $this->em->find($assoc['targetEntity'], $normalizedAssociatedId);
break;
}

if ($newValue === null) {
break;
}

$this->registerManaged($newValue, $associatedId, []);
break;
}

$this->originalEntityData[$oid][$field] = $newValue;
Expand Down

0 comments on commit 66c4c76

Please sign in to comment.