1
0
mirror of synced 2024-12-13 14:56:01 +03:00

[DDC-1610] Add test and fix wakeup reflection in combination with event listener

This commit is contained in:
Benjamin Eberlei 2012-01-21 13:58:25 +01:00
parent 44831f21c1
commit faf92883b6
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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;
}
}