mappingNotFoundInClassNorDescendants() public static method

public static mappingNotFoundInClassNorDescendants ( string $className, string $fieldName ) : MappingException
$className string
$fieldName string
return MappingException
Esempio n. 1
0
 /**
  * Gets reference mapping for current field from current class or its descendants.
  *
  * @return array
  * @throws MappingException
  */
 private function getReferenceMapping()
 {
     $mapping = null;
     try {
         $mapping = $this->class->getFieldMapping($this->currentField);
     } catch (MappingException $e) {
         if (empty($this->class->discriminatorMap)) {
             throw $e;
         }
         $foundIn = null;
         foreach ($this->class->discriminatorMap as $child) {
             $childClass = $this->dm->getClassMetadata($child);
             if ($childClass->hasAssociation($this->currentField)) {
                 if ($mapping !== null && $mapping !== $childClass->getFieldMapping($this->currentField)) {
                     throw MappingException::referenceFieldConflict($this->currentField, $foundIn->name, $childClass->name);
                 }
                 $mapping = $childClass->getFieldMapping($this->currentField);
                 $foundIn = $childClass;
             }
         }
         if ($mapping === null) {
             throw MappingException::mappingNotFoundInClassNorDescendants($this->class->name, $this->currentField);
         }
     }
     return $mapping;
 }