Split of functionality in separate functions
This commit is contained in:
parent
3df494ddc8
commit
4d48781e2b
@ -2390,24 +2390,8 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->visitedCollections =
|
$this->visitedCollections =
|
||||||
$this->orphanRemovals = array();
|
$this->orphanRemovals = array();
|
||||||
} else {
|
} else {
|
||||||
$visited = array();
|
$this->clearIdentityMap($entityName);
|
||||||
|
$this->clearIdentityInsertions($entityName);
|
||||||
foreach ($this->identityMap as $className => $entities) {
|
|
||||||
if ($className !== $entityName) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($entities as $entity) {
|
|
||||||
$this->doDetach($entity, $visited, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->entityInsertions as $hash => $entity) {
|
|
||||||
if (get_class($entity) != $entityName) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
unset($this->entityInsertions[$hash]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->evm->hasListeners(Events::onClear)) {
|
if ($this->evm->hasListeners(Events::onClear)) {
|
||||||
@ -3470,4 +3454,34 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
{
|
{
|
||||||
$this->hydrationCompleteHandler->hydrationComplete();
|
$this->hydrationCompleteHandler->hydrationComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entityName
|
||||||
|
*/
|
||||||
|
private function clearIdentityMap($entityName)
|
||||||
|
{
|
||||||
|
$visited = array();
|
||||||
|
|
||||||
|
foreach ($this->identityMap as $className => $entities) {
|
||||||
|
if ($className !== $entityName) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($entities as $entity) {
|
||||||
|
$this->doDetach($entity, $visited, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $entityName
|
||||||
|
*/
|
||||||
|
private function clearIdentityInsertions($entityName)
|
||||||
|
{
|
||||||
|
foreach ($this->entityInsertions as $hash => $entity) {
|
||||||
|
if (get_class($entity) === $entityName) {
|
||||||
|
unset($this->entityInsertions[$hash]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user