mapChildren() public method

public mapChildren ( array $mapping, ClassMetadata $inherited = null )
$mapping array
$inherited ClassMetadata
 /**
  * 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);
 }
 /**
  * @expectedException \Doctrine\ODM\PHPCR\Mapping\MappingException
  */
 public function testMapChildrenInvalidFetchDepth()
 {
     $cm = new ClassMetadata('Doctrine\\Tests\\ODM\\PHPCR\\Mapping\\Person');
     $cm->initializeReflection(new RuntimeReflectionService());
     $cm->mapChildren(array('fieldName' => 'address', 'fetchDepth' => 'invalid'));
 }