/**
  * Adds inherited association mappings to the subclass mapping.
  *
  * @param \Doctrine\ODM\MongoDB\Mapping\ClassMetadata $subClass
  * @param \Doctrine\ODM\MongoDB\Mapping\ClassMetadata $parentClass
  *
  * @return void
  *
  * @throws MappingException
  */
 private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass)
 {
     foreach ($parentClass->associationMappings as $field => $mapping) {
         if ($parentClass->isMappedSuperclass) {
             $mapping['sourceDocument'] = $subClass->name;
         }
         if (!isset($mapping['inherited']) && !$parentClass->isMappedSuperclass) {
             $mapping['inherited'] = $parentClass->name;
         }
         if (!isset($mapping['declared'])) {
             $mapping['declared'] = $parentClass->name;
         }
         $subClass->addInheritedAssociationMapping($mapping);
     }
 }