From 0ffc752f6f85dbf72a426b3527e90ab8e4d9aabe Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 13 Jan 2015 01:42:03 +0100 Subject: [PATCH] #470 DDC-54 DDC-3005 - simple-object hydration should also trigger `postLoad` events when iterating over single results --- .../ORM/Functional/LifecycleCallbackTest.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php index d1b020e03..9b60c43b2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php @@ -2,6 +2,7 @@ namespace Doctrine\Tests\ORM\Functional; use Doctrine\ORM\Event\PreUpdateEventArgs; +use Doctrine\ORM\Query; class LifecycleCallbackTest extends \Doctrine\Tests\OrmFunctionalTestCase { @@ -235,6 +236,30 @@ DQL; break; } } + /** + * @group DDC-54 + * @group DDC-3005 + */ + public function testCascadedEntitiesNotLoadedInPostLoadDuringIterationWithSimpleObjectHydrator() + { + $this->_em->persist(new LifecycleCallbackTestEntity()); + $this->_em->persist(new LifecycleCallbackTestEntity()); + + $this->_em->flush(); + $this->_em->clear(); + + $result = $this + ->_em + ->createQuery('SELECT e FROM Doctrine\Tests\ORM\Functional\LifecycleCallbackTestEntity AS e') + ->iterate(null, Query::HYDRATE_SIMPLEOBJECT); + + foreach ($result as $entity) { + $this->assertTrue($entity[0]->postLoadCallbackInvoked); + $this->assertFalse($entity[0]->postLoadCascaderNotNull); + + break; + } + } public function testLifecycleCallbacksGetInherited() {