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