1
0
mirror of synced 2025-02-20 22:23:14 +03:00

#470 DDC-54 DDC-3005 - simple-object hydration should also trigger postLoad events when iterating over single results

This commit is contained in:
Marco Pivetta 2015-01-13 01:42:03 +01:00
parent 5cd73f0d12
commit 0ffc752f6f

View File

@ -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()
{