1
0
mirror of synced 2025-02-02 21:41:45 +03:00

#5579 cleaning up postCommitClear implementation

This commit is contained in:
Marco Pivetta 2017-08-18 09:21:53 +02:00
parent 9707701d10
commit 2921f068b7
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -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->entityUpdates =
$this->entityDeletions =
@ -431,22 +429,24 @@ class UnitOfWork implements PropertyChangedListener
$this->collectionUpdates =
$this->collectionDeletions =
$this->visitedCollections =
$this->orphanRemovals = array();
$this->orphanRemovals = [];
if (null === $entity) {
$this->entityChangeSets = $this->scheduledForSynchronization = [];
return;
}
if (is_object($entity)) {
$entity = [$entity];
}
$entities = \is_object($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->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] = [];
}
/**
* @param $class
* @param string $oid
*/
private function clearScheduledForSynchronization($class, $oid)
{
unset($this->scheduledForSynchronization[$class->rootEntityName][$oid]);
}
/* PropertyChangedListener implementation */
/**