protected function AbstractClassMetadataFactory::loadMetadata in Plug 7
Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded.
Important: The class $name does not necesarily exist at this point here. Scenarios in a code-generation setup might have access to XML/YAML Mapping files without the actual PHP code existing here. That is why the {should be used for reflection.
Parameters
string $name The name of the class for which the metadata should get loaded.:
Return value
array
See also
Doctrine\Common\Persistence\Mapping\ReflectionService} interface
1 call to AbstractClassMetadataFactory::loadMetadata()
- AbstractClassMetadataFactory::getMetadataFor in lib/
doctrine/ common/ lib/ Doctrine/ Common/ Persistence/ Mapping/ AbstractClassMetadataFactory.php - Gets the class metadata descriptor for a class.
File
- lib/
doctrine/ common/ lib/ Doctrine/ Common/ Persistence/ Mapping/ AbstractClassMetadataFactory.php, line 303
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\MappingCode
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;
}