Adds inherited association mappings to the subclass mapping.

@throws MappingException
776010
private function addInheritedRelations(ClassMetadata $subClass, ClassMetadata $parentClass) : void
    {
        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);
        }
    }
378611
private function remapAssociation($classMetadata, $mapping)
    {
        $newMapping = $this->resolveTargetEntities[$mapping['targetEntity']];
        $newMapping = array_replace_recursive($mapping, $newMapping);
        $newMapping['fieldName'] = $mapping['fieldName'];

        unset($classMetadata->associationMappings[$mapping['fieldName']]);

        switch ($mapping['type']) {
            case ClassMetadata::MANY_TO_MANY:
                $classMetadata->mapManyToMany($newMapping);
                break;
            case ClassMetadata::MANY_TO_ONE:
                $classMetadata->mapManyToOne($newMapping);
                break;
            case ClassMetadata::ONE_TO_MANY:
                $classMetadata->mapOneToMany($newMapping);
                break;
            case ClassMetadata::ONE_TO_ONE:
                $classMetadata->mapOneToOne($newMapping);
                break;
        }
    }
266460
public static function addType(string $name, string $className) : void
    {
        if (isset(self::$typesMap[$name])) {
            throw MappingException::typeExists($name);
        }

        self::$typesMap[$name] = $className;
    }
390943
public void addMapping(Mapping mapping)
    {
        if (mapping != null)
        {
            mappings.put(mapping.getType(), mapping);
        }
    }
725810
public function setInheritanceType($type)
    {
        if ( ! $this->_isInheritanceType($type)) {
            throw MappingException::invalidInheritanceType($this->name, $type);
        }
        $this->inheritanceType = $type;
    }
823717
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);
        }
    }
1166574
private function addInheritedNamedQueries(ClassMetadata $subClass, ClassMetadata $parentClass)
    {
        foreach ($parentClass->namedQueries as $name => $query) {
            if ( ! isset ($subClass->namedQueries[$name])) {
                $subClass->addNamedQuery(array(
                    'name'  => $query['name'],
                    'query' => $query['query']
                ));
            }
        }
    }
316034
@Resource(name = "portletPropertyToAttributeMappings")
    public void setPropertyMappings(Map<String, String> propertyMappings) {
        this.propertyToAttributeMappings = ImmutableBiMap.copyOf(propertyMappings);
        this.attributeToPropertyMappings = this.propertyToAttributeMappings.inverse();
    }
361191
public function validateAssociations()
    {
        foreach ($this->associationMappings as $mapping) {
            if ( ! ClassLoader::classExists($mapping['targetEntity']) ) {
                throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']);
            }
        }
    }
902701
public function validateIdentifier() : void
    {
        if ($this->isMappedSuperclass || $this->isEmbeddedClass) {
            return;
        }

        // Verify & complete identifier mapping
        if (! $this->identifier) {
            throw MappingException::identifierRequired($this->className);
        }

        $explicitlyGeneratedProperties = array_filter($this->declaredProperties, static function (Property $property) : bool {
            return $property instanceof FieldMetadata
                && $property->isPrimaryKey()
                && $property->hasValueGenerator();
        });

        if ($explicitlyGeneratedProperties && $this->isIdentifierComposite()) {
            throw MappingException::compositeKeyAssignedIdGeneratorRequired($this->className);
        }
    }
598161
public void addBeanToBeanMapping(BeanToBeanMapping beanToBeanMapping) {
		beanToBeanMappings.put(ClassPair.get(beanToBeanMapping
				.getSourceClass(), beanToBeanMapping.getDestinationClass()),
				beanToBeanMapping);
	}
679414
protected void addAttributes(final boolean _inherited,
                                 final Attribute... _attributes)
        throws CacheReloadException
    {
        for (final Attribute attribute : _attributes) {
            if (!this.attributes.containsKey(attribute.getName())) {
                Type.LOG.trace("adding Attribute:'{}' to type: '{}'", attribute.getName(), getName());
                // evaluate for type attribute
                if (attribute.getAttributeType().getClassRepr().equals(TypeType.class)) {
                    this.typeAttributeName = attribute.getName();
                } else if (attribute.getAttributeType().getClassRepr().equals(StatusType.class) && !_inherited) {
                    // evaluate for status, an inherited attribute will not
                    // overwrite the original attribute
                    this.statusAttributeName = attribute.getName();
                } else if (attribute.getAttributeType().getClassRepr().equals(CompanyLinkType.class)
                                || attribute.getAttributeType().getClassRepr().equals(ConsortiumLinkType.class)) {
                    // evaluate for company
                    this.companyAttributeName = attribute.getName();
                } else if (attribute.getAttributeType().getClassRepr().equals(GroupLinkType.class)) {
                    // evaluate for group
                    this.groupAttributeName = attribute.getName();
                }
                this.attributes.put(attribute.getName(), attribute);
                if (attribute.getTable() != null) {
                    this.tables.add(attribute.getTable());
                    attribute.getTable().addType(getId());
                    if (getMainTable() == null) {
                        setMainTable(attribute.getTable());
                    }
                }
                setDirty();
            }
        }
    }
1064994
public JdbcMapperBuilder<T> addMapping(final ResultSetMetaData metaData) throws SQLException {
        for (int i = 1; i <= metaData.getColumnCount(); i++) {
            addMapping(metaData.getColumnLabel(i), i, metaData.getColumnType(i));
        }

        return this;
    }
347343
private function buildToOneAssociationMappings(Mapping\ClassMetadata $metadata)
    {
        $tableName   = $metadata->getTableName();
        $primaryKeys = $this->getTablePrimaryKeys($this->tables[$tableName]);
        $foreignKeys = $this->getTableForeignKeys($this->tables[$tableName]);

        foreach ($foreignKeys as $foreignKey) {
            $foreignTableName   = $foreignKey->getForeignTableName();
            $fkColumns          = $foreignKey->getColumns();
            $fkForeignColumns   = $foreignKey->getForeignColumns();
            $localColumn        = current($fkColumns);
            $associationMapping = [
                'fieldName'    => $this->getFieldNameForColumn($tableName, $localColumn, true),
                'targetEntity' => $this->getClassNameForTable($foreignTableName),
            ];

            if ($metadata->getProperty($associationMapping['fieldName'])) {
                $associationMapping['fieldName'] .= '2'; // "foo" => "foo2"
            }

            if ($primaryKeys && in_array($localColumn, $primaryKeys, true)) {
                $associationMapping['id'] = true;
            }

            for ($i = 0, $l = count($fkColumns); $i < $l; $i++) {
                $joinColumn = new Mapping\JoinColumnMetadata();

                $joinColumn->setColumnName($fkColumns[$i]);
                $joinColumn->setReferencedColumnName($fkForeignColumns[$i]);

                $associationMapping['joinColumns'][] = $joinColumn;
            }

            // Here we need to check if $fkColumns are the same as $primaryKeys
            if (! array_diff($fkColumns, $primaryKeys)) {
                $metadata->addProperty($associationMapping);
            } else {
                $metadata->addProperty($associationMapping);
            }
        }
    }
1097159
public function validateChildClasses()
    {
        if (count($this->childClasses) > 0 && $this->isLeaf) {
            throw new MappingException(sprintf(
                'Cannot map a document as a leaf and define child classes for "%s"',
                $this->name
            ));
        }
    }
1286008
private function addInheritedIndexes(ClassMetadata $subClass, ClassMetadata $parentClass)
    {
        if ($subClass->isEmbeddedDocument) {
            return;
        }

        $indexFactory = new IndexFactory($subClass);
        $parentIndex  = $parentClass->getIndex();

        if ($parentIndex !== null) {
            $index = $indexFactory->createInherited($parentIndex);
            $subClass->setIndex($index);
        }

        foreach ($parentClass->getSecondaryIndexes() as $parentIndex) {
            $index = $indexFactory->createInherited($parentIndex);
            $subClass->addSecondaryIndex($index);
        }
    }
929595
public final void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException 
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "Set TypeMap to " + typeMap); 
        try{
            sqlConn.setTypeMap(typeMap);
        } catch(SQLFeatureNotSupportedException nse){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(this, tc, "supportsGetTypeMap false due to ", nse);
            mcf.supportsGetTypeMap = false;
            throw nse;
        } catch(UnsupportedOperationException uoe){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(this, tc, "supportsGetTypeMap false due to ", uoe);
            mcf.supportsGetTypeMap = false;
            throw uoe;
        }
        connectionPropertyChanged = true; 
    }