Commit 74a43288 authored by romanb's avatar romanb

[2.0] Refactored UoW#createEntity slightly for perf. reasons (documented properly now).

parent 8fbcf7d5
......@@ -1808,7 +1808,11 @@ class UnitOfWork implements PropertyChangedListener
$newValue = $assoc->load($entity, null, $this->_em, $associatedId);
} else {
$newValue = $this->_em->getProxyFactory()->getProxy($assoc->targetEntityName, $associatedId);
$this->registerManaged($newValue, $associatedId, array());
// PERF: Inlined & optimized code from UnitOfWork#registerManaged()
$newValueOid = spl_object_hash($newValue);
$this->_entityIdentifiers[$newValueOid] = $associatedId;
$this->_identityMap[$targetClass->rootEntityName][$relatedIdHash] = $newValue;
$this->_entityStates[$newValueOid] = self::STATE_MANAGED;
}
}
$this->_originalEntityData[$oid][$field] = $newValue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment