#5579 cleaning up postCommitClear
implementation
This commit is contained in:
parent
9707701d10
commit
2921f068b7
@ -418,12 +418,10 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null|object|array $entity
|
* @param null|object|object[] $entity
|
||||||
*/
|
*/
|
||||||
private function postCommitClear($entity = null)
|
private function postCommitClear($entity) : void
|
||||||
{
|
{
|
||||||
|
|
||||||
// Clear up
|
|
||||||
$this->entityInsertions =
|
$this->entityInsertions =
|
||||||
$this->entityUpdates =
|
$this->entityUpdates =
|
||||||
$this->entityDeletions =
|
$this->entityDeletions =
|
||||||
@ -431,22 +429,24 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->collectionUpdates =
|
$this->collectionUpdates =
|
||||||
$this->collectionDeletions =
|
$this->collectionDeletions =
|
||||||
$this->visitedCollections =
|
$this->visitedCollections =
|
||||||
$this->orphanRemovals = array();
|
$this->orphanRemovals = [];
|
||||||
|
|
||||||
if (null === $entity) {
|
if (null === $entity) {
|
||||||
$this->entityChangeSets = $this->scheduledForSynchronization = [];
|
$this->entityChangeSets = $this->scheduledForSynchronization = [];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_object($entity)) {
|
$entities = \is_object($entity)
|
||||||
$entity = [$entity];
|
? [$entity]
|
||||||
}
|
: $entity;
|
||||||
|
|
||||||
|
foreach ($entities as $object) {
|
||||||
|
$oid = \spl_object_hash($object);
|
||||||
|
|
||||||
foreach ($entity as $object) {
|
|
||||||
$oid = spl_object_hash($object);
|
|
||||||
$class = $this->em->getClassMetadata(get_class($object));
|
|
||||||
$this->clearEntityChangeSet($oid);
|
$this->clearEntityChangeSet($oid);
|
||||||
$this->clearScheduledForSynchronization($class, $oid);
|
|
||||||
|
unset($this->scheduledForSynchronization[$this->em->getClassMetadata(\get_class($object))->rootEntityName][$oid]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3127,15 +3127,6 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->entityChangeSets[$oid] = [];
|
$this->entityChangeSets[$oid] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $class
|
|
||||||
* @param string $oid
|
|
||||||
*/
|
|
||||||
private function clearScheduledForSynchronization($class, $oid)
|
|
||||||
{
|
|
||||||
unset($this->scheduledForSynchronization[$class->rootEntityName][$oid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PropertyChangedListener implementation */
|
/* PropertyChangedListener implementation */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user