1
0
Fork 0
mirror of synced 2025-04-03 13:23:37 +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 // Invoke driver
try { try {
$this->driver->loadMetadataForClass($className, $class); $this->driver->loadMetadataForClass($className, $class);
$this->wakeupReflection($class, $this->getReflectionService());
} catch (ReflectionException $e) { } catch (ReflectionException $e) {
throw MappingException::reflectionFailure($className, $e); throw MappingException::reflectionFailure($className, $e);
} }
@ -333,6 +332,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
$eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($class, $this->em); $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($class, $this->em);
$this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs); $this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
} }
$this->wakeupReflection($class, $this->getReflectionService());
$this->validateRuntimeMetadata($class, $parent); $this->validateRuntimeMetadata($class, $parent);

View file

@ -9,6 +9,9 @@ require_once __DIR__ . '/../../TestInit.php';
class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase
{ {
/**
* @group DDC-1610
*/
public function testEvent() public function testEvent()
{ {
$em = $this->_getTestEntityManager(); $em = $this->_getTestEntityManager();
@ -17,6 +20,8 @@ class ClassMetadataLoadEventTest extends \Doctrine\Tests\OrmTestCase
$evm->addEventListener(Events::loadClassMetadata, $this); $evm->addEventListener(Events::loadClassMetadata, $this);
$classMetadata = $metadataFactory->getMetadataFor('Doctrine\Tests\ORM\Mapping\LoadEventTestEntity'); $classMetadata = $metadataFactory->getMetadataFor('Doctrine\Tests\ORM\Mapping\LoadEventTestEntity');
$this->assertTrue($classMetadata->hasField('about')); $this->assertTrue($classMetadata->hasField('about'));
$this->assertArrayHasKey('about', $classMetadata->reflFields);
$this->assertInstanceOf('ReflectionProperty', $classMetadata->reflFields['about']);
} }
public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs) public function loadClassMetadata(\Doctrine\ORM\Event\LoadClassMetadataEventArgs $eventArgs)
@ -48,4 +53,4 @@ class LoadEventTestEntity
private $name; private $name;
private $about; private $about;
} }