private function checkAliasOrClass($aliasOrClass, $document)
 {
     if ($this->metadataFactory->hasAlias($aliasOrClass)) {
         $class = $this->metadataFactory->getMetadataForAlias($aliasOrClass)->getClass();
     } elseif (!class_exists($aliasOrClass)) {
         throw new DocumentManagerException(sprintf('Unknown class specified and no alias exists for "%s", known aliases: "%s"', $aliasOrClass, implode('", "', $this->metadataFactory->getAliases())));
     } else {
         $class = $aliasOrClass;
     }
     if (get_class($document) !== $class) {
         throw new DocumentNotFoundException(sprintf('Requested document of type "%s" but got document of type "%s"', $aliasOrClass, get_class($document)));
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getAliases()
 {
     return $this->metadataFactory->getAliases();
 }