Пример #1
0
 /**
  * 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];
 }
Пример #2
0
 /**
  * Whether the class with the specified name should have its metadata loaded.
  * This is only the case if it is either mapped as an Entity or a
  * MappedSuperclass.
  *
  * @param string $className
  * @return boolean
  */
 public function isTransient($className)
 {
     if ($this->classCache === null) {
         $this->initialize();
     }
     if (isset($this->classCache[$className])) {
         return false;
     }
     return !$this->locator->fileExists($className);
 }