Permalink
Browse files

DDC-2173 - Correct issue is about "postFlush" not "preFlush" and add …

…test
  • Loading branch information...
beberlei committed Jan 6, 2013
1 parent c20cfed commit 0b2d3d4f5d41c56fa07ff8d7ada406ec8bb34046
Showing with 10 additions and 2 deletions.
  1. +2 −2 UPGRADE.md
  2. +8 −0 tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php
View
@@ -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.
@@ -57,6 +57,7 @@ public function testPreAndOnFlushCalledAlways()
$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 @@ public function onFlush($args)
{
$this->onFlush++;
}
+
+ public function postFlush($args)
+ {
+ $this->postFlush++;
+ }
}
+

0 comments on commit 0b2d3d4

Please sign in to comment.