Skip to content

Commit

Permalink
Fix issue when using notify tracking policy with multiple flush on en…
Browse files Browse the repository at this point in the history
…tity
  • Loading branch information
xhuberty committed Dec 29, 2015
1 parent 3ca6828 commit 6d50a66
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,34 @@ public function commit($entity = null)
$this->entityUpdates =
$this->entityDeletions =
$this->extraUpdates =
$this->entityChangeSets =
$this->collectionUpdates =
$this->collectionDeletions =
$this->visitedCollections =
$this->scheduledForSynchronization =
$this->orphanRemovals = array();

if ($entity === null) {
$this->entityChangeSets = $this->scheduledForSynchronization = array();
} elseif (is_object($entity)) {
$oid = spl_object_hash($entity);
$class = $this->em->getClassMetadata(get_class($entity));
if (isset($this->entityChangeSets[$oid])) {
unset($this->entityChangeSets[$oid]);
}
if (isset($this->scheduledForSynchronization[$class->rootEntityName][$oid])) {
unset($this->scheduledForSynchronization[$class->rootEntityName][$oid]);
}
} elseif (is_array($entity)) {
foreach ($entity as $object) {
$oid = spl_object_hash($object);
$class = $this->em->getClassMetadata(get_class($object));
if (isset($this->entityChangeSets[$oid])) {
unset($this->entityChangeSets[$oid]);
}
if (isset($this->scheduledForSynchronization[$class->rootEntityName][$oid])) {
unset($this->scheduledForSynchronization[$class->rootEntityName][$oid]);
}
}
}
}

/**
Expand Down

0 comments on commit 6d50a66

Please sign in to comment.