{@inheritDoc}

@throws MappingException
15959
public function mapRelations($meta, array $relationOverrides)
    {
        /* @var $relationOverride \CmsDoctrine\Mapping\Annotation\RelationOverride */
        foreach ($relationOverrides as $relationOverride) {
            if (!(($fieldName = $relationOverride->name) &&
                !$meta->isInheritedAssociation($fieldName))
            ) {
                continue;
            }

            $override = $this->relationToArray($relationOverride);

            // Check for JoinColumn|JoinColumns annotations
            if ($relationOverride->joinColumns) {
                $override['joinColumns'] = [];
                foreach ($relationOverride->joinColumns as $joinColumn) {
                    $override['joinColumns'][] = $this->joinColumnToArray($joinColumn);
                }
            } elseif ($relationOverride->joinColumn) {
                $override['joinColumns'][] = $this->joinColumnToArray($relationOverride->joinColumn);
            }

            // Check for JoinTable annotations
            if ($joinTableAnnot = $relationOverride->joinTable) {
                $joinTable = [
                    'name' => $joinTableAnnot->name,
                    'schema' => $joinTableAnnot->schema
                ];

                foreach ($joinTableAnnot->joinColumns as $joinColumn) {
                    $joinTable['joinColumns'][] = $this->joinColumnToArray($joinColumn);
                }

                foreach ($joinTableAnnot->inverseJoinColumns as $joinColumn) {
                    $joinTable['inverseJoinColumns'][] = $this->joinColumnToArray($joinColumn);
                }

                $override['joinTable'] = $joinTable;
            }

            if ($meta->hasAssociation($fieldName)) {
                $mapping = $meta->getAssociationMapping($fieldName);

                if (isset($override['type']) &&
                    !$this->guardAssociationTypeOverride($mapping['type'], $override['type'])
                ) {
                    throw new MappingException(sprintf(
                        'Cannot override mapping type of %s',
                        $meta->getName() . '::$' . $fieldName
                    ));
                }

                $override = array_replace($mapping, $override);
                unset($meta->associationMappings[$fieldName]);

            } elseif (!$meta->getReflectionClass()->isAbstract()) {
                $class = $meta->getReflectionClass();
                $prop = $class->getProperty($fieldName);
                $prop->setAccessible(true);
                $value = $prop->getValue($class->newInstanceWithoutConstructor());
                if (!$this->guardAssociationTypeMapping($value, $override['type'])) {
                    throw new MappingException(sprintf(
                        'Can\'t set association mapping on %s',
                        $meta->getName() . '::$' . $fieldName
                    ));
                }
            }

            if (!isset($override['mappedBy'])) { // owning side
                /* @var $objectManager \Doctrine\ORM\EntityManager */
                $objectManager  = $this->getObjectManager();
                /* @var $namingStrategy \CmsDoctrineORM\Mapping\DefaultNamingStrategy */
                $namingStrategy = $objectManager->getConfiguration()->getNamingStrategy();

                if ($override['type'] === ClassMetadata::MANY_TO_MANY || !empty($override['joinTable'])) {
                    if (empty($override['joinTable']['name'])) {
                        $override['joinTable']['name'] = $namingStrategy->joinTableName(
                            $meta->getName(),
                            $override['targetEntity'],
                            $override['fieldName']
                        );
                    }

                    if (!empty($override['joinTable']['joinColumns'])) {
                        foreach ($override['joinTable']['joinColumns'] as $key => $column) {
                            if (empty($column['name'])) {
                                $override['joinTable']['joinColumns'][$key]['name'] =
                                    $namingStrategy->joinKeyColumnName($meta->getName());
                            }
                        }
                    } else {
                        $override['joinTable']['joinColumns'] = [
                            [
                                'name' => $namingStrategy->joinKeyColumnName($meta->getName()),
                                'referencedColumnName' => $namingStrategy->referenceColumnName(),
                            ],
                        ];
                    }

                    if (!empty($override['joinTable']['inverseJoinColumns'])) {
                        foreach ($override['joinTable']['inverseJoinColumns'] as $key => $column) {
                            if (empty($column['name'])) {
                                $override['joinTable']['inverseJoinColumns'][$key]['name'] =
                                    $namingStrategy->joinKeyColumnName($override['targetEntity']);
                            }
                        }
                    } else {
                        $override['joinTable']['inverseJoinColumns'] = [
                            [
                                'name' => $namingStrategy->joinKeyColumnName($override['targetEntity']),
                                'referencedColumnName' => $namingStrategy->referenceColumnName(),
                            ],
                        ];
                    }
                } else {
                    if (!empty($override['joinColumn'])) {
                        if (empty($override['joinColumn']['name'])) {
                            $override['joinColumn']['name']
                                = $namingStrategy->joinColumnName($override['fieldName']);
                        }
                    } else {
                        $override['joinColumn'] = [
                            'name' => $namingStrategy->joinColumnName($override['fieldName']),
                            'referencedColumnName' => $namingStrategy->referenceColumnName(),
                        ];
                    }
                }
            }

            switch ($override['type']) {
                case ClassMetadata::ONE_TO_ONE:
                    $meta->mapOneToOne($override);
                    break;
                case ClassMetadata::ONE_TO_MANY:
                    $meta->mapOneToMany($override);
                    break;
                case ClassMetadata::MANY_TO_ONE:
                    $meta->mapManyToOne($override);
                    break;
                case ClassMetadata::MANY_TO_MANY:
                    $meta->mapManyToMany($override);
                    break;
            }
        }
    }
1154003
public function validate()
    {
        if (!$this->translatable) {
            throw new MappingException(sprintf('No translatable specified for %s', $this->name));
        }

        if (!$this->targetEntity) {
            throw new MappingException(sprintf('No translatable targetEntity specified for %s', $this->name));
        }

        if (!$this->locale) {
            throw new MappingException(sprintf('No locale specified for %s', $this->name));
        }
    }
943067
public function validateTranslatables()
    {
        if (count($this->translatableFields) > 0) {
            if (null === $this->translator) {
                throw MappingException::noTranslatorStrategy($this->name, $this->translatableFields);
            }
        }
    }
720092
protected static function setHideProperties(array &$mappedClass, Mapping $mapping, string $className)
    {
        if (false === empty($mappedClass[static::HIDE_PROPERTIES_KEY])) {
            $mapping->setHiddenProperties($mappedClass[static::HIDE_PROPERTIES_KEY]);
            foreach ($mapping->getHiddenProperties() as $propertyName) {
                if (false === \in_array($propertyName, static::getClassProperties($className), true)) {
                    throw new MappingException(
                        \sprintf(
                            'Could not hide property %s in class %s because it does not exist.',
                            $propertyName,
                            $className
                        )
                    );
                }
            }
        }
    }
79133
public static void mapping(String mappedFieldName, String mappedClassName, String targetFieldName, String targetClassName){
		throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException4,mappedFieldName,mappedClassName, targetFieldName,targetClassName));
	}
390943
public void addMapping(Mapping mapping)
    {
        if (mapping != null)
        {
            mappings.put(mapping.getType(), mapping);
        }
    }
1031192
public function map($obj, $mappingName, $context = [])
    {
        if (!$mappingName || !array_key_exists($mappingName, $this->mappings)) {
            throw new \InvalidArgumentException(sprintf('Invalid mapping name "%s"', $mappingName));
        }

        if (empty($obj) && !$this->shouldAcceptEmptyValues($context, $obj)) {
            return $obj;
        }

        $mapping = @$this->mappings[$mappingName];

        return $this->resolve($mapping, $obj, $context);
    }
51991
public function addDiscriminatorMapClass($name, $className)
    {
        $className = $this->fullyQualifiedClassName($className);
        $className = ltrim($className, '\\');
        $this->discriminatorMap[$name] = $className;

        if ($this->name === $className) {
            $this->discriminatorValue = $name;

            return;
        }

        if ( ! (class_exists($className) || interface_exists($className))) {
            throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
        }

        if (is_subclass_of($className, $this->name) && ! in_array($className, $this->subClasses)) {
            $this->subClasses[] = $className;
        }
    }
360227
public function setDiscriminatorColumn($columnDef)
    {
        if ($columnDef !== null) {
            if ( ! isset($columnDef['name'])) {
                throw MappingException::nameIsMandatoryForDiscriminatorColumns($this->name);
            }

            if (isset($this->fieldNames[$columnDef['name']])) {
                throw MappingException::duplicateColumnName($this->name, $columnDef['name']);
            }

            if ( ! isset($columnDef['fieldName'])) {
                $columnDef['fieldName'] = $columnDef['name'];
            }

            if ( ! isset($columnDef['type'])) {
                $columnDef['type'] = "string";
            }

            if (in_array($columnDef['type'], array("boolean", "array", "object", "datetime", "time", "date"))) {
                throw MappingException::invalidDiscriminatorColumnType($this->name, $columnDef['type']);
            }

            $this->discriminatorColumn = $columnDef;
        }
    }
274546
public function validateIdentifier()
    {
        if ($this->isMappedSuperclass || $this->isEmbeddedClass) {
            return;
        }

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

        if ($this->usesIdGenerator() && $this->isIdentifierComposite) {
            throw MappingException::compositeKeyAssignedIdGeneratorRequired($this->name);
        }
    }
1161803
private function completeMappingTypeValidation($className, ClassMetadataInfo $class)
    {
        foreach ($class->fieldMappings as $fieldName => $mapping) {
            if (Type::hasType($mapping['type'])) {
                continue;
            }

            // Support type as a mapped class?
            if (!$this->hasMetadataFor($mapping['type']) && !$this->getMetadataFor($mapping['type'])) {
                throw MappingException::fieldTypeNotFound($className, $fieldName, $mapping['type']);
            }

            // Mapped classes must have binding node type XML_ELEMENT
            if ($mapping['node'] !== ClassMetadataInfo::XML_ELEMENT) {
                throw MappingException::customTypeWithoutNodeElement($className, $fieldName);
            }
        }
    }
723840
public function getSingleAssociationReferencedJoinColumnName($fieldName)
    {
        if ( ! $this->isAssociationWithSingleJoinColumn($fieldName)) {
            throw MappingException::noSingleAssociationJoinColumnFound($this->name, $fieldName);
        }
        return $this->associationMappings[$fieldName]['joinColumns'][0]['referencedColumnName'];
    }
826377
public function setAssociationOverride($fieldName, array $overrideMapping)
    {
        if ( ! isset($this->associationMappings[$fieldName])) {
            throw MappingException::invalidOverrideFieldName($this->name, $fieldName);
        }

        $mapping = $this->associationMappings[$fieldName];

        if (isset($overrideMapping['joinColumns'])) {
            $mapping['joinColumns'] = $overrideMapping['joinColumns'];
        }

        if (isset($overrideMapping['joinTable'])) {
            $mapping['joinTable'] = $overrideMapping['joinTable'];
        }

        $mapping['joinColumnFieldNames']        = null;
        $mapping['joinTableColumns']            = null;
        $mapping['sourceToTargetKeyColumns']    = null;
        $mapping['relationToSourceKeyColumns']  = null;
        $mapping['relationToTargetKeyColumns']  = null;

        switch ($mapping['type']) {
            case self::ONE_TO_ONE:
                $mapping = $this->_validateAndCompleteOneToOneMapping($mapping);
                break;
            case self::ONE_TO_MANY:
                $mapping = $this->_validateAndCompleteOneToManyMapping($mapping);
                break;
            case self::MANY_TO_ONE:
                $mapping = $this->_validateAndCompleteOneToOneMapping($mapping);
                break;
            case self::MANY_TO_MANY:
                $mapping = $this->_validateAndCompleteManyToManyMapping($mapping);
                break;
        }

        $this->associationMappings[$fieldName] = $mapping;
    }
392208
public static void mapping(String mappedFieldName,Class<?> mappedClass, Class<?> targetClass){
		throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2,mappedFieldName,mappedClass.getSimpleName(),targetClass.getSimpleName()));
	}
1266715
protected function _validateAndCompleteFieldMapping(array &$mapping)
    {
        // Check mandatory fields
        if ( ! isset($mapping['fieldName']) || strlen($mapping['fieldName']) == 0) {
            throw MappingException::missingFieldName($this->name);
        }
        if ( ! isset($mapping['type'])) {
            // Default to string
            $mapping['type'] = 'string';
        }

        // Complete fieldName and columnName mapping
        if ( ! isset($mapping['columnName'])) {
            $mapping['columnName'] = $this->namingStrategy->propertyToColumnName($mapping['fieldName'], $this->name);
        }

        if ($mapping['columnName'][0] === '`') {
            $mapping['columnName']  = trim($mapping['columnName'], '`');
            $mapping['quoted']      = true;
        }

        $this->columnNames[$mapping['fieldName']] = $mapping['columnName'];
        if (isset($this->fieldNames[$mapping['columnName']]) || ($this->discriminatorColumn != null && $this->discriminatorColumn['name'] == $mapping['columnName'])) {
            throw MappingException::duplicateColumnName($this->name, $mapping['columnName']);
        }

        $this->fieldNames[$mapping['columnName']] = $mapping['fieldName'];

        // Complete id mapping
        if (isset($mapping['id']) && $mapping['id'] === true) {
            if ($this->versionField == $mapping['fieldName']) {
                throw MappingException::cannotVersionIdField($this->name, $mapping['fieldName']);
            }

            if ( ! in_array($mapping['fieldName'], $this->identifier)) {
                $this->identifier[] = $mapping['fieldName'];
            }
            // Check for composite key
            if ( ! $this->isIdentifierComposite && count($this->identifier) > 1) {
                $this->isIdentifierComposite = true;
            }
        }

        if (Type::hasType($mapping['type']) && Type::getType($mapping['type'])->canRequireSQLConversion()) {
            if (isset($mapping['id']) && $mapping['id'] === true) {
                 throw MappingException::sqlConversionNotAllowedForIdentifiers($this->name, $mapping['fieldName'], $mapping['type']);
            }

            $mapping['requireSQLConversion'] = true;
        }
    }
918991
public function mapAll($elements, $mappingName, $context = [], $disassociate = false)
    {
        if (!is_array($elements)) {
            throw new \RuntimeException('MapAll expected an array');
        }

        if (empty($elements)) {
            return $elements;
        }

        $res = [];
        foreach ($elements as $key => $element) {
            $element = ($disassociate) ? ['key' => $key, 'value' => $element] : $element;
            $res[$key] = $this->map($element, $mappingName, $context);
        }

        return $res;
    }
212575
public function setDiscriminatorMap(array $map)
    {
        foreach ($map as $value => $className) {
            if (strpos($className, '\\') === false && strlen($this->namespace)) {
                $className = $this->namespace . '\\' . $className;
            }
            $this->discriminatorMap[$value] = $className;
            if ($this->name == $className) {
                $this->discriminatorValue = $value;
            } else {
                if ( ! class_exists($className)) {
                    throw MappingException::invalidClassInDiscriminatorMap($className, $this->name);
                }
                if (is_subclass_of($className, $this->name)) {
                    $this->subClasses[] = $className;
                }
            }
        }
    }