[DDC-1610] Add test and fix wakeup reflection in combination with event listener
This commit is contained in:
parent
44831f21c1
commit
faf92883b6
@ -291,7 +291,6 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
// Invoke driver
|
||||
try {
|
||||
$this->driver->loadMetadataForClass($className, $class);
|
||||
$this->wakeupReflection($class, $this->getReflectionService());
|
||||
} catch (ReflectionException $e) {
|
||||
throw MappingException::reflectionFailure($className, $e);
|
||||
}
|
||||
@ -333,6 +332,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
$eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($class, $this->em);
|
||||
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
|
||||
}
|
||||
$this->wakeupReflection($class, $this->getReflectionService());
|
||||
|
||||
$this->validateRuntimeMetadata($class, $parent);
|
||||
|
||||
|
@ -9,6 +9,9 @@ require_once __DIR__ . '/../../TestInit.php';
|
||||
|
||||
class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase
|
||||
{
|
||||
/**
|
||||
* @group DDC-1610
|
||||
*/
|
||||
public function testEvent()
|
||||
{
|
||||
$em = $this->_getTestEntityManager();
|
||||
@ -17,6 +20,8 @@ class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase
|
||||
$evm->addEventListener(Events::loadClassMetadata, $this);
|
||||
$classMetadata = $metadataFactory->getMetadataFor('Doctrine\Tests\ORM\Mapping\LoadEventTestEntity');
|
||||
$this->assertTrue($classMetadata->hasField('about'));
|
||||
$this->assertArrayHasKey('about', $classMetadata->reflFields);
|
||||
$this->assertInstanceOf('ReflectionProperty', $classMetadata->reflFields['about']);
|
||||
}
|
||||
|
||||
public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs)
|
||||
@ -48,4 +53,4 @@ class LoadEventTestEntity
|
||||
private $name;
|
||||
|
||||
private $about;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user