From f5eb20b63d030b2c0bcd8b8ab3ebb243b06a383d Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 11 Nov 2014 15:50:55 +0100 Subject: [PATCH] `OnClassMetadataNotFoundEventArgs` should support setting the actually resolved `ClassMetadata` as a mutable event result vector --- .../OnClassMetadataNotFoundEventArgs.php | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php b/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php index 8eac9afc0..6d7b128ed 100644 --- a/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php +++ b/lib/Doctrine/ORM/Event/OnClassMetadataNotFoundEventArgs.php @@ -20,7 +20,9 @@ namespace Doctrine\ORM\Event; use Doctrine\Common\EventArgs; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\EntityManager; +use Doctrine\ORM\EntityManagerInterface; /** * Class that holds event arguments for a loadMetadata event. @@ -31,27 +33,48 @@ use Doctrine\ORM\EntityManager; class OnClassMetadataNotFoundEventArgs extends EventArgs { /** - * @var \Doctrine\ORM\Mapping\ClassMetadata + * @var string */ private $className; /** - * @var \Doctrine\ORM\EntityManager + * @var EntityManagerInterface */ private $em; + /** + * @var ClassMetadata|null + */ + private $foundMetadata; + /** * Constructor. * - * @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata - * @param \Doctrine\ORM\EntityManager $em + * @param string $className + * @param EntityManagerInterface $em */ - public function __construct($className, EntityManager $em) + public function __construct($className, EntityManagerInterface $em) { - $this->className = $className; + $this->className = (string) $className; $this->em = $em; } + /** + * @param ClassMetadata|null $classMetadata + */ + public function setFoundMetadata(ClassMetadata $classMetadata = null) + { + $this->foundMetadata = $classMetadata; + } + + /** + * @return ClassMetadata|null + */ + public function getFoundMetadata() + { + return $this->foundMetadata; + } + /** * Retrieve associated ClassMetadata. *