1
0
mirror of synced 2024-12-05 03:06:05 +03:00

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

This commit is contained in:
Benjamin Eberlei 2013-01-06 19:16:12 +01:00
parent c20cfed6ae
commit 0b2d3d4f5d
2 changed files with 10 additions and 2 deletions

View File

@ -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.

View File

@ -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++;
}
}