/**
  * Loads the metadata for the specified class into the provided container.
  *
  * @param string $className
  * @param ClassMetadata $metadata
  * @throws \Doctrine\ORM\ODMAdapter\Exception\MappingException
  * @return void
  */
 public function loadMetadataForClass($className, ClassMetadata $metadata)
 {
     /** @var $class \Doctrine\ORM\ODMAdapter\Mapping\ClassMetadata */
     $reflClass = $metadata->getReflectionClass();
     $documentAnnots = array();
     foreach ($this->reader->getClassAnnotations($reflClass) as $annot) {
         foreach ($this->entityAnnotationClasses as $annotClass => $i) {
             if ($annot instanceof $annotClass) {
                 $documentAnnots[$i] = $annot;
             }
         }
     }
     if (!$documentAnnots) {
         throw MappingException::classIsNotAValidDocument($className);
     }
     $metadata->className = $className;
     foreach ($reflClass->getProperties() as $property) {
         if ($metadata->className !== $property->getDeclaringClass()->getName()) {
             continue;
         }
         $mapping = array();
         $mapping['fieldName'] = $property->getName();
         foreach ($this->reader->getPropertyAnnotations($property) as $propertyAnnotation) {
             if ($propertyAnnotation instanceof Adapter\ReferencePhpcr) {
                 $mapping['type'] = Reference::PHPCR;
                 $this->extractReferencedObjects($propertyAnnotation, $metadata, $className, $mapping);
             }
             if ($propertyAnnotation instanceof Adapter\ReferenceDbalOrm) {
                 $mapping['type'] = Reference::DBAL_ORM;
                 $this->extractReferencedObjects($propertyAnnotation, $metadata, $className, $mapping);
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  *
  * @throws MappingException
  */
 public function loadMetadata($className)
 {
     if (class_exists($className)) {
         return parent::loadMetadata($className);
     }
     throw MappingException::classNotFound($className);
 }
 /**
  * {@inheritDoc}
  */
 public function getField($fieldName)
 {
     if (!$this->hasField($fieldName)) {
         throw MappingException::fieldNotFound($this->className, $fieldName);
     }
     return $this->mappings[$fieldName];
 }