Ensure onFlush and postFlush events are always raised
This commit is contained in:
parent
ce290bc99b
commit
9322ca7052
@ -281,16 +281,15 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! ($this->entityInsertions ||
|
$anythingToDo =
|
||||||
|
$this->entityInsertions ||
|
||||||
$this->entityDeletions ||
|
$this->entityDeletions ||
|
||||||
$this->entityUpdates ||
|
$this->entityUpdates ||
|
||||||
$this->collectionUpdates ||
|
$this->collectionUpdates ||
|
||||||
$this->collectionDeletions ||
|
$this->collectionDeletions ||
|
||||||
$this->orphanRemovals)) {
|
$this->orphanRemovals;
|
||||||
return; // Nothing to do.
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->orphanRemovals) {
|
if ($anythingToDo && $this->orphanRemovals) {
|
||||||
foreach ($this->orphanRemovals as $orphan) {
|
foreach ($this->orphanRemovals as $orphan) {
|
||||||
$this->remove($orphan);
|
$this->remove($orphan);
|
||||||
}
|
}
|
||||||
@ -301,6 +300,7 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->evm->dispatchEvent(Events::onFlush, new Event\OnFlushEventArgs($this->em));
|
$this->evm->dispatchEvent(Events::onFlush, new Event\OnFlushEventArgs($this->em));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($anythingToDo) {
|
||||||
// Now we need a commit order to maintain referential integrity
|
// Now we need a commit order to maintain referential integrity
|
||||||
$commitOrder = $this->getCommitOrder();
|
$commitOrder = $this->getCommitOrder();
|
||||||
|
|
||||||
@ -353,6 +353,7 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
foreach ($this->visitedCollections as $coll) {
|
foreach ($this->visitedCollections as $coll) {
|
||||||
$coll->takeSnapshot();
|
$coll->takeSnapshot();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Raise postFlush
|
// Raise postFlush
|
||||||
if ($this->evm->hasListeners(Events::postFlush)) {
|
if ($this->evm->hasListeners(Events::postFlush)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user