protected function AbstractClassMetadataFactory::loadMetadata

Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded.

Parameters

string $name The name of the class for which the metadata should get loaded.:

Return value

array

1 call to AbstractClassMetadataFactory::loadMetadata()
AbstractClassMetadataFactory::getMetadataFor in drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php
Gets the class metadata descriptor for a class.

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php, line 273

Class

AbstractClassMetadataFactory
The ClassMetadataFactory is used to create ClassMetadata objects that contain all the metadata mapping informations of a class which describes how a class should be mapped to a relational database.

Namespace

Doctrine\Common\Persistence\Mapping

Code

protected function loadMetadata($name) {
  if (!$this->initialized) {
    $this
      ->initialize();
  }
  $loaded = array();
  $parentClasses = $this
    ->getParentClasses($name);
  $parentClasses[] = $name;

  // Move down the hierarchy of parent classes, starting from the topmost class
  $parent = null;
  $rootEntityFound = false;
  $visited = array();
  $reflService = $this
    ->getReflectionService();
  foreach ($parentClasses as $className) {
    if (isset($this->loadedMetadata[$className])) {
      $parent = $this->loadedMetadata[$className];
      if ($this
        ->isEntity($parent)) {
        $rootEntityFound = true;
        array_unshift($visited, $className);
      }
      continue;
    }
    $class = $this
      ->newClassMetadataInstance($className);
    $this
      ->initializeReflection($class, $reflService);
    $this
      ->doLoadMetadata($class, $parent, $rootEntityFound, $visited);
    $this->loadedMetadata[$className] = $class;
    $parent = $class;
    if ($this
      ->isEntity($class)) {
      $rootEntityFound = true;
      array_unshift($visited, $className);
    }
    $this
      ->wakeupReflection($class, $reflService);
    $loaded[] = $className;
  }
  return $loaded;
}