Gets the class metadata descriptor for a class.
string $className The name of the class.:
\Doctrine\Common\Persistence\Mapping\ClassMetadata
Overrides ClassMetadataFactory::getMetadataFor
public function getMetadataFor($className) {
if (isset($this->loadedMetadata[$className])) {
return $this->loadedMetadata[$className];
}
$realClassName = $className;
// Check for namespace alias
if (strpos($className, ':') !== false) {
list($namespaceAlias, $simpleClassName) = explode(':', $className);
$realClassName = $this
->getFqcnFromAlias($namespaceAlias, $simpleClassName);
}
else {
$realClassName = ClassUtils::getRealClass($realClassName);
}
if (isset($this->loadedMetadata[$realClassName])) {
// We do not have the alias name in the map, include it
$this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName];
return $this->loadedMetadata[$realClassName];
}
if ($this->cacheDriver) {
if (($cached = $this->cacheDriver
->fetch($realClassName . $this->cacheSalt)) !== false) {
$this->loadedMetadata[$realClassName] = $cached;
$this
->wakeupReflection($cached, $this
->getReflectionService());
}
else {
foreach ($this
->loadMetadata($realClassName) as $loadedClassName) {
$this->cacheDriver
->save($loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null);
}
}
}
else {
$this
->loadMetadata($realClassName);
}
if ($className != $realClassName) {
// We do not have the alias name in the map, include it
$this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName];
}
return $this->loadedMetadata[$className];
}