diff --git a/UPGRADE.md b/UPGRADE.md index 1b7e8a90c..64d8d12bc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,8 +1,8 @@ # Upgrade to 2.4 -## OnFlush and PreFlush event always called +## OnFlush and PostFlush event always called -Before 2.4 the preFlush and onFlush events were only called when there were +Before 2.4 the postFlush and onFlush events were only called when there were actually entities that changed. Now these events are called no matter if there are entities in the UoW or changes are found. diff --git a/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php b/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php index 156e89b0e..b338db3e0 100644 --- a/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php @@ -57,6 +57,7 @@ class FlushEventTest extends \Doctrine\Tests\OrmFunctionalTestCase $listener = new OnFlushCalledListener(); $this->_em->getEventManager()->addEventListener(Events::onFlush, $listener); $this->_em->getEventManager()->addEventListener(Events::preFlush, $listener); + $this->_em->getEventManager()->addEventListener(Events::postFlush, $listener); $this->_em->flush(); @@ -115,6 +116,7 @@ class OnFlushCalledListener { public $preFlush = 0; public $onFlush = 0; + public $postFlush = 0; public function preFlush($args) { @@ -125,4 +127,10 @@ class OnFlushCalledListener { $this->onFlush++; } + + public function postFlush($args) + { + $this->postFlush++; + } } +