/** * Tries to get a mapping for a given class * * @param $className * @return null|array|object */ protected function _getMapping($className) { //try loading mapping from original driver first $mapping = null; if (!is_null($this->_originalDriver)) { if ($this->_originalDriver instanceof FileDriver || $this->_originalDriver instanceof AbstractFileDriver) { $mapping = $this->_originalDriver->getElement($className); } } //if no mapping found try to load mapping file again if (is_null($mapping)) { $yaml = $this->_loadMappingFile($this->locator->findMappingFile($className)); $mapping = $yaml[$className]; } return $mapping; }
/** * Gets 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. * * @param string $className * * @return array The element of schema meta data. * * @throws \Exception */ public function getElement($className) { if (!$this->locator->fileExists($className)) { return; } if ($this->classCache === null) { $this->initialize(); } if (isset($this->classCache[$className])) { return $this->classCache[$className]; } $result = $this->loadMappingFile($this->locator->findMappingFile($className)); if (!isset($result[$className])) { throw new \Exception(sprintf('Invalid mapping file %s for class %s.', $className, str_replace('\\', '.', $className) . $this->locator->getFileExtension())); } return $result[$className]; }
/** * 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 */ public function getElement($className) { if ($this->classCache === null) { $this->initialize(); } if (isset($this->classCache[$className])) { return $this->classCache[$className]; } $result = $this->loadMappingFile($this->locator->findMappingFile($className)); return $result[$className]; }
/** * Gets 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. * * @param string $className * * @return array The element of schema meta data. * * @throws MappingException */ public function getElement($className) { if ($this->classCache === null) { $this->initialize(); } if (isset($this->classCache[$className])) { return $this->classCache[$className]; } $result = $this->loadMappingFile($this->locator->findMappingFile($className)); if (!isset($result[$className])) { throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); } return $result[$className]; }