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->entityUpdates ||
|
||||
$this->collectionUpdates ||
|
||||
$this->collectionDeletions ||
|
||||
$this->orphanRemovals)) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
$this->orphanRemovals;
|
||||
|
||||
if ($this->orphanRemovals) {
|
||||
if ($anythingToDo && $this->orphanRemovals) {
|
||||
foreach ($this->orphanRemovals as $orphan) {
|
||||
$this->remove($orphan);
|
||||
}
|
||||
@ -301,6 +300,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$this->evm->dispatchEvent(Events::onFlush, new Event\OnFlushEventArgs($this->em));
|
||||
}
|
||||
|
||||
if ($anythingToDo) {
|
||||
// Now we need a commit order to maintain referential integrity
|
||||
$commitOrder = $this->getCommitOrder();
|
||||
|
||||
@ -353,6 +353,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
foreach ($this->visitedCollections as $coll) {
|
||||
$coll->takeSnapshot();
|
||||
}
|
||||
}
|
||||
|
||||
// Raise postFlush
|
||||
if ($this->evm->hasListeners(Events::postFlush)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user