private function addInheritedAttributes(ClassMetadata $subClass, ClassMetadata $parentClass)
    {
        $propertyFactory = new PropertyMetadataFactory($subClass);

        foreach ($parentClass->propertyMetadata as $attributeName => $parentMapping) {
            //in case of inheritance from superclass, otherwise this would be caught by the mapping driver:
            if ($subClass->isEmbeddedDocument && $parentMapping->strategy === PropertyMetadata::STORAGE_STRATEGY_ADD_TO_SET) {
                throw MappingException::addToSetOnEmbeddedDocument($subClass->name, $parentMapping->name);
            }

            $mapping = $propertyFactory->createInherited($parentClass, $parentMapping);

            $subClass->addAttributeMapping($mapping);
        }
    }