From bb998d1738f6d0c722892b68b43cbefc23c6ec9d Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Tue, 17 Jan 2012 13:55:42 +0100 Subject: [PATCH] Emulating feature that has to be moved to Doctrine\Common --- .../ORM/Mapping/Driver/AbstractFileDriver.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php index 7075ee646..0d8720708 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/AbstractFileDriver.php @@ -60,6 +60,23 @@ abstract class AbstractFileDriver extends FileDriver implements Driver return $this->locator->getPaths(); } + /** + * Get the element of schema meta data for the class from the mapping file. + * This will lazily load the mapping file if it is not loaded yet + * + * @return array $element The element of schema meta data + * @throws MappingException + * @todo move behavior to FileDriver + */ + public function getElement($className) + { + $result = parent::getElement($className); + if($result === null) { + throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); + } + return $result; + } + /** * Finds the mapping file for the class with the given name by searching * through the configured paths.