mapNode() 공개 메소드

public mapNode ( array $mapping, ClassMetadata $inherited = null )
$mapping array
$inherited ClassMetadata
예제 #1
0
 /**
  * Adds inherited fields to the subclass mapping.
  *
  * @param ClassMetadata $subClass
  * @param ClassMetadata $parentClass
  */
 private function addInheritedFields(ClassMetadata $subClass, ClassMetadata $parentClass)
 {
     foreach ($parentClass->fieldMappings as $fieldName) {
         $subClass->mapField($parentClass->mappings[$fieldName], $parentClass);
     }
     foreach ($parentClass->referenceMappings as $fieldName) {
         $mapping = $parentClass->mappings[$fieldName];
         if ($mapping['type'] == ClassMetadata::MANY_TO_ONE) {
             $subClass->mapManyToOne($mapping, $parentClass);
         } else {
             $subClass->mapManyToMany($mapping, $parentClass);
         }
     }
     foreach ($parentClass->childMappings as $fieldName) {
         $mapping = $parentClass->mappings[$fieldName];
         $subClass->mapChild($mapping, $parentClass);
     }
     foreach ($parentClass->childrenMappings as $fieldName) {
         $subClass->mapChildren($parentClass->mappings[$fieldName], $parentClass);
     }
     foreach ($parentClass->referrersMappings as $fieldName) {
         $subClass->mapReferrers($parentClass->mappings[$fieldName], $parentClass);
     }
     if ($parentClass->identifier) {
         $subClass->mapId($parentClass->mappings[$parentClass->identifier], $parentClass);
     }
     if ($parentClass->node) {
         $subClass->mapNode($parentClass->mappings[$parentClass->node], $parentClass);
     }
     if ($parentClass->nodename) {
         $subClass->mapNodename($parentClass->mappings[$parentClass->nodename], $parentClass);
     }
     if ($parentClass->parentMapping) {
         $subClass->mapParentDocument($parentClass->mappings[$parentClass->parentMapping], $parentClass);
     }
     if ($parentClass->localeMapping) {
         $subClass->mapLocale($parentClass->mappings[$parentClass->localeMapping], $parentClass);
     }
     if ($parentClass->versionNameField) {
         $subClass->mapVersionName($parentClass->mappings[$parentClass->versionNameField], $parentClass);
     }
     if ($parentClass->versionCreatedField) {
         $subClass->mapVersionCreated($parentClass->mappings[$parentClass->versionCreatedField], $parentClass);
     }
     if ($parentClass->lifecycleCallbacks) {
         $subClass->mapLifecycleCallbacks($parentClass->lifecycleCallbacks);
     }
     $subClass->setReferenceable($parentClass->referenceable);
     // Versionable defaults to false - only set on child class if it is non-false
     if ($parentClass->versionable) {
         $subClass->setVersioned($parentClass->versionable);
     }
     $subClass->setTranslator($parentClass->translator);
     $subClass->setNodeType($parentClass->nodeType);
     $subClass->setCustomRepositoryClassName($parentClass->customRepositoryClassName);
 }