Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory::getMetadataFor PHP Method

getMetadataFor() public method

public getMetadataFor ( $className )
    public function getMetadataFor($className)
    {
        $metadata = parent::getMetadataFor($className);
        if ($metadata) {
            return $metadata;
        }
        throw MappingException::classNotMapped($className);
    }

Usage Example

示例#1
0
 /**
  * {@inheritDoc}
  */
 protected function walkSourceDocument(SourceDocument $node)
 {
     $alias = $node->getAlias();
     $documentFqn = $node->getDocumentFqn();
     // cache the metadata for this document
     /** @var $meta ClassMetadata */
     $meta = $this->mdf->getMetadataFor($documentFqn);
     if (null === $meta->getName()) {
         throw new \RuntimeException(sprintf('%s is not a mapped document', $documentFqn));
     }
     $this->aliasMetadata[$alias] = $meta;
     if ($this->locale && $meta->translator) {
         $this->translator[$alias] = $this->dm->getTranslationStrategy($meta->translator);
     }
     $nodeType = $meta->getNodeType();
     // make sure we add the phpcr:{class,classparents} constraints
     // unless the document has a unique type; From is dispatched first,
     // so these will always be the primary constraints.
     if (!$meta->hasUniqueNodeType()) {
         $this->sourceDocumentNodes[$alias] = $node;
     }
     // get the PHPCR Alias
     $alias = $this->qomf->selector($alias, $nodeType);
     return $alias;
 }
All Usage Examples Of Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory::getMetadataFor