. */ namespace Doctrine\ORM\Mapping\Driver; use Doctrine\ORM\Mapping\MappingException; use Doctrine\Common\Persistence\Mapping\Driver\FileDriver; /** * Base driver for file-based metadata drivers. * * A file driver operates in a mode where it loads the mapping files of individual * classes on demand. This requires the user to adhere to the convention of 1 mapping * file per class and the file names of the mapping files must correspond to the full * class name, including namespace, with the namespace delimiters '\', replaced by dots '.'. * * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.doctrine-project.com * @since 2.0 * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan H. Wage * @author Roman Borschel */ abstract class AbstractFileDriver extends FileDriver implements Driver { /** * Append lookup paths to metadata driver. * * @param array $paths */ public function addPaths(array $paths) { $this->locator->addPaths($paths); } /** * Retrieve the defined metadata lookup paths. * * @return array */ public function getPaths() { 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. * * @param $className * @return string The (absolute) file name. * @throws MappingException */ protected function findMappingFile($className) { return $this->locator->findMappingFile($className); } }