diff --git a/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php b/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php index 862152a99..15ea0799a 100644 --- a/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php +++ b/lib/Doctrine/ORM/Event/LoadClassMetadataEventArgs.php @@ -4,6 +4,9 @@ namespace Doctrine\ORM\Event; use Doctrine\Common\EventArgs; +use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\ORM\EntityManager; + /** * Class that holds event arguments for a loadMetadata event. * @@ -12,16 +15,40 @@ use Doctrine\Common\EventArgs; */ class LoadClassMetadataEventArgs extends EventArgs { - private $_classMetadata; + /** + * @var ClassMetadata + */ + private $classMetadata; - public function __construct(\Doctrine\ORM\Mapping\ClassMetadata $classMetadata) + /** + * @var EntityManager + */ + private $em; + + /** + * @param ClassMetadata $classMetadata + * @param EntityManager $em + */ + public function __construct(ClassMetadata $classMetadata, EntityManager $em) { - $this->_classMetadata = $classMetadata; + $this->classMetadata = $classMetadata; + $this->em = $em; } + /** + * @return ClassMetadata + */ public function getClassMetadata() { - return $this->_classMetadata; + return $this->classMetadata; + } + + /** + * @return EntityManager + */ + public function getEntityManager() + { + return $this->em; } } diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 51994f334..5f1de3883 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -309,7 +309,7 @@ class ClassMetadataFactory $class->setParentClasses($visited); if ($this->evm->hasListeners(Events::loadClassMetadata)) { - $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($class); + $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($class, $this->em); $this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs); }