Skip to content

Commit

Permalink
DDC-2173 - Correct issue is about "postFlush" not "preFlush" and add …
Browse files Browse the repository at this point in the history
…test
  • Loading branch information
beberlei committed Jan 6, 2013
1 parent c20cfed commit 0b2d3d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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.

Expand Down
8 changes: 8 additions & 0 deletions tests/Doctrine/Tests/ORM/Functional/FlushEventTest.php
Expand Up @@ -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();

Expand Down Expand Up @@ -115,6 +116,7 @@ class OnFlushCalledListener
{
public $preFlush = 0;
public $onFlush = 0;
public $postFlush = 0;

public function preFlush($args)
{
Expand All @@ -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.