Skip to content

Functional ticket for DDC-2484 #685

Closed
wants to merge 2 commits into from

2 participants

@TomHAnderson

This PR represents different data paths through the ORM. When an entity is lazy loaded each field is loaded into proxies one at a time so the entity itself is never fetched from the database, only the data on the entity. This demonstrates how data lazy loaded through proxies does bypass the postLoad lifecycle event.

@beberlei beberlei commented on the diff Aug 10, 2013
.../Doctrine/Tests/ORM/Functional/Ticket/DDC2484Test.php
+ $this->assertEquals('Volkswagen', $lazyDriver->getCar()->getBrand()); // Should be BMW
+ }
+}
+
+class ORMEvents
+{
+ public function __construct($evm)
+ {
+ $evm->addEventListener(array(
+ EVENTS::postLoad,
+ ), $this);
+ }
+
+ public function postLoad(LifecycleEventArgs $args)
+ {
+ if (get_class($args->getEntity()) == 'Doctrine\Tests\ORM\Functional\Ticket\DDC2484_Car') {
@beberlei
Doctrine member
beberlei added a note Aug 10, 2013

this is wrong, its a proxy, you need to use instanceof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@beberlei beberlei closed this Aug 10, 2013
@beberlei
Doctrine member

Wrong assumption using get_class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.