protected function loadMetadata($name)
 {
     $origName = $name;
     if ($this->config instanceof Kdyby\Doctrine\Configuration) {
         $name = $this->config->getTargetEntityClassName($name);
     }
     if (!class_exists($name)) {
         throw new Kdyby\Doctrine\MissingClassException("Metadata of class {$name} was not found, because the class is missing or cannot be autoloaded.");
     }
     $result = parent::loadMetadata($name);
     if ($name !== $origName) {
         $this->setMetadataFor($origName, $this->getMetadataFor($name));
     }
     return $result;
 }