DDC-2173 - Correct issue is about "postFlush" not "preFlush" and add test
This commit is contained in:
parent
c20cfed6ae
commit
0b2d3d4f5d
@ -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 @@ 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user