@return void

@throws MappingException
323152
private function makeGenerator()
    {
        if ($this->generatorStrategy !== null) {
            switch ($this->generatorStrategy) {
                case self::GENERATOR_TYPE_ALNUM:
                    $this->generator = new AlnumGenerator($this->className, $this->name);

                    if (isset($this->generatorOptions['pad'])) {
                        $this->generator->setPad($this->generatorOptions['pad']);
                    }
                    if (isset($this->generatorOptions['chars'])) {
                        $this->generator->setChars($this->generatorOptions['chars']);
                    } elseif (isset($this->generatorOptions['awkwardSafe'])) {
                        $this->generator->setAwkwardSafeMode($this->generatorOptions['awkwardSafe']);
                    }

                    break;

                case self::GENERATOR_TYPE_INCREMENT:
                    $this->generator = new IncrementGenerator($this->className, $this->name);

                    if (isset($this->generatorOptions['hash'])) {
                        $this->generator->setHash($this->generatorOptions['key']);
                    }
                    if (isset($this->generatorOptions['range'])) {
                        $this->generator->setRange($this->generatorOptions['range']);
                    }
                    if (isset($this->generatorOptions['startingValue'])) {
                        $this->generator->setStartingValue($this->generatorOptions['startingValue']);
                    }
                    if (isset($this->generatorOptions['table'])) {
                        $this->generator->setTable($this->generatorOptions['table']);
                    }

                    break;

                case self::GENERATOR_TYPE_UUID:
                    $this->generator = new UuidGenerator();

                    if (isset($this->generatorOptions['salt'])) {
                        $this->generator->setSalt($this->generatorOptions['salt']);
                    }

                    break;

                case self::GENERATOR_TYPE_CUSTOM:
                    if (empty($this->generatorOptions['class'])) {
                        throw MappingException::missingCustomGeneratorClass($this);
                    }

                    $customGenerator = new $this->generatorOptions['class'];
                    if (!$customGenerator instanceof ValueGenerator) {
                        throw MappingException::classIsNotAValidGenerator(get_class($customGenerator));
                    }

                    $methods = get_class_methods($customGenerator);
                    foreach ($this->generatorOptions as $name => $value) {
                        $method = 'set' . ucfirst($name);
                        if (!in_array($method, $methods)) {
                            throw MappingException::missingGeneratorSetter(get_class($customGenerator), $name);
                        }

                        $customGenerator->$method($value);
                    }

                    $this->generator = $customGenerator;

                    break;

                default:
                    throw new MappingException('Unknown generator type: ' . $this->generatorStrategy);
            }
        }
    }
1102867
private void initializeMapper() {
    if (valueClass == null) {
      valueMapper = CatchAllMapper.getInstance();
    } else {
      try {
        valueMapper = MapperFactory.getInstance().getMapper(valueClass);
      } catch (NoSuitableMapperException exp) {
        valueMapper = CatchAllMapper.getInstance();
      }

    }
  }
201439
public function boot()
    {
        if (! $this->hasMapping()) {
            throw new RuntimeException("There is no Schema Mapper registered for [{$this->type()}] connection.");
        }

        $schemas = forward_static_call([$this->getMapper(), 'schemas'], $this->connection);

        foreach ($schemas as $schema) {
            $this->make($schema);
        }
    }
365843
protected function mapWebRoutes(): void
    {
        $file = $this->basePath.'routes/web.php';

        if (file_exists($file)) {
            $this->loadRoutesFrom(
                Route::middleware('web')
                ->group($file));
        }
    }
427900
public function setPropertyOverride(Property $property) : void
    {
        $fieldName = $property->getName();

        if (! isset($this->declaredProperties[$fieldName])) {
            throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
        }

        $originalProperty          = $this->getProperty($fieldName);
        $originalPropertyClassName = get_class($originalProperty);

        // If moving from transient to persistent, assume it's a new property
        if ($originalPropertyClassName === TransientMetadata::class) {
            unset($this->declaredProperties[$fieldName]);

            $this->addProperty($property);

            return;
        }

        // Do not allow to change property type
        if ($originalPropertyClassName !== get_class($property)) {
            throw MappingException::invalidOverridePropertyType($this->className, $fieldName);
        }

        // Do not allow to change version property
        if ($originalProperty instanceof VersionFieldMetadata) {
            throw MappingException::invalidOverrideVersionField($this->className, $fieldName);
        }

        unset($this->declaredProperties[$fieldName]);

        if ($property instanceof FieldMetadata) {
            // Unset defined fieldName prior to override
            unset($this->fieldNames[$originalProperty->getColumnName()]);

            // Revert what should not be allowed to change
            $property->setDeclaringClass($originalProperty->getDeclaringClass());
            $property->setPrimaryKey($originalProperty->isPrimaryKey());
        } elseif ($property instanceof AssociationMetadata) {
            // Unset all defined fieldNames prior to override
            if ($originalProperty instanceof ToOneAssociationMetadata && $originalProperty->isOwningSide()) {
                foreach ($originalProperty->getJoinColumns() as $joinColumn) {
                    unset($this->fieldNames[$joinColumn->getColumnName()]);
                }
            }

            // Override what it should be allowed to change
            if ($property->getInversedBy()) {
                $originalProperty->setInversedBy($property->getInversedBy());
            }

            if ($property->getFetchMode() !== $originalProperty->getFetchMode()) {
                $originalProperty->setFetchMode($property->getFetchMode());
            }

            if ($originalProperty instanceof ToOneAssociationMetadata && $property->getJoinColumns()) {
                $originalProperty->setJoinColumns($property->getJoinColumns());
            } elseif ($originalProperty instanceof ManyToManyAssociationMetadata && $property->getJoinTable()) {
                $originalProperty->setJoinTable($property->getJoinTable());
            }

            $property = $originalProperty;
        }

        $this->addProperty($property);
    }
599758
public function setIndex(Index $index)
    {
        if ($this->isEmbeddedDocument) {
            throw MappingException::embeddedDocumentsNotIndexable($this->getName());
        }

        if ($this->index !== null) {
            throw MappingException::indexExists($this->getName(), 'primary');
        }

        $this->index = $index;
    }
1003352
public function routing(): void
    {
        $routingClass = $this->configs['routing'];
        try {
            $this->module('routing', new $routingClass());
        } catch (CoreException $e) {
            throw new CoreException($e->getMessage());
        }
    }
729105
private function addMappings()
    {
        $indicesSettings = $this->indexSettings->getIndicesConfig();

        foreach ($this->_data as $requestName => $requestConfig) {
            $index = $requestConfig['index'];
            $this->_data[$requestName]['mapping'] = $indicesSettings[$index]['mapping'];
        }

        return $this;
    }
851543
public function validateAssociations() : void
    {
        array_map(
            function (Property $property) {
                if (! ($property instanceof AssociationMetadata)) {
                    return;
                }

                $targetEntity = $property->getTargetEntity();

                if (! class_exists($targetEntity)) {
                    throw MappingException::invalidTargetEntityClass($targetEntity, $this->className, $property->getName());
                }
            },
            $this->declaredProperties
        );
    }
255271
public function setMapping($mapping)
    {
        if ($this->serialized !== null) {
            throw ODMException::valueObjectAlreadySerialized();
        }

        $this->mapping = $mapping;

        $this->serialize();
    }
254217
protected function resetMappingOptions()
    {
        $this->mappingOptions = new \stdClass();
        $this->mappingOptions->destructiveMapping = false;
        $this->mappingOptions->assignNonMappedColumns = true;
        $this->mappingOptions->fieldPrefix = '';
        $this->mappingOptions->throwOnEmptyId = false;
        $this->mappingOptions->mapUnmappedColumns = true;
    }
816282
public function initialize()
    {
        $contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion();

        foreach ($contentTypes as $contentType) {
            $this->schemaGenerator->createMapping($contentType);
        }
    }
1278143
protected static function setRelationships(array &$mappedClass, Mapping $mapping, string $className)
    {
        if (!empty($mappedClass[static::RELATIONSHIPS_KEY])) {
            foreach ($mappedClass[static::RELATIONSHIPS_KEY] as $propertyName => $urls) {
                if (false === \in_array($propertyName, static::getClassProperties($className))) {
                    throw new MappingException(
                        \sprintf(
                            'Could not find property %s in class %s because it does not exist.',
                            $propertyName,
                            $className
                        )
                    );
                }

                $mapping->setRelationshipUrls($propertyName, $urls);
            }
        }
    }
474695
private function validate()
    {
        if ($this->name === null && $this->attributeName === null) {
            throw MappingException::missingPropertyName($this->className);
        }

        if ($this->collectionClass !== null) {
            $rColl = new \ReflectionClass($this->collectionClass);
            if (!$rColl->implementsInterface('Doctrine\\Common\\Collections\\Collection')) {
                throw MappingException::collectionClassDoesNotImplementCommonInterface($this->className, $this->attributeName, $this->collectionClass);
            }
        }

        if ($this->reference !== null && empty($this->targetDocument) && empty($this->discriminatorMap) &&
            ($this->mappedBy !== null || $this->inversedBy !== null)) {
            throw MappingException::owningAndInverseReferencesRequireTargetDocument($this->className, $this->name);
        }

        if (!empty($this->prime) && ($this->association !== self::ASSOCIATION_TYPE_REFERENCE_MANY || !$this->isInverseSide === true)) {
            throw MappingException::referencePrimersOnlySupportedForInverseReferenceMany($this->className, $this->name);
        }

        if ($this->repositoryMethod !== null && $this->limit !== null) {
            throw MappingException::repositoryMethodCanNotBeCombinedWithLimit($this->className, $this->name);
        }
    }
116553
public function setMappings(array $mappings) {
        $this->mappings = [];

        foreach ($mappings as $contentType => $dataClass) {
            $this->addMapping($contentType, $dataClass);
        }
    }
313955
public function mapField(array $mapping)
    {
        if ( ! isset($mapping['fieldName']) && isset($mapping['name'])) {
            $mapping['fieldName'] = $mapping['name'];
        }
        if ( ! isset($mapping['fieldName'])) {
            throw MappingException::missingFieldName($this->name);
        }
        if ( ! isset($mapping['name'])) {
            $mapping['name'] = $mapping['fieldName'];
        }
        if (isset($this->fieldMappings[$mapping['fieldName']])) {
            //throw MappingException::duplicateFieldMapping($this->name, $mapping['fieldName']);
        }
        if ($this->discriminatorField !== null && $this->discriminatorField == $mapping['name']) {
            throw MappingException::discriminatorFieldConflict($this->name, $this->discriminatorField);
        }
        if (isset($mapping['targetDocument']) && strpos($mapping['targetDocument'], '\\') === false && strlen($this->namespace)) {
            $mapping['targetDocument'] = $this->namespace . '\\' . $mapping['targetDocument'];
        }

        if (isset($mapping['discriminatorMap'])) {
            foreach ($mapping['discriminatorMap'] as $key => $class) {
                if (strpos($class, '\\') === false && strlen($this->namespace)) {
                    $mapping['discriminatorMap'][$key] = $this->namespace . '\\' . $class;
                }
            }
        }

        if (isset($mapping['cascade']) && isset($mapping['embedded'])) {
            throw MappingException::cascadeOnEmbeddedNotAllowed($this->name, $mapping['fieldName']);
        }

        $cascades = isset($mapping['cascade']) ? array_map('strtolower', (array) $mapping['cascade']) : array();

        if (in_array('all', $cascades) || isset($mapping['embedded'])) {
            $cascades = array('remove', 'persist', 'refresh', 'merge', 'detach');
        }

        if (isset($mapping['embedded'])) {
            unset($mapping['cascade']);
        } elseif (isset($mapping['cascade'])) {
            $mapping['cascade'] = $cascades;
        }

        $mapping['isCascadeRemove'] = in_array('remove', $cascades);
        $mapping['isCascadePersist'] = in_array('persist', $cascades);
        $mapping['isCascadeRefresh'] = in_array('refresh', $cascades);
        $mapping['isCascadeMerge'] = in_array('merge', $cascades);
        $mapping['isCascadeDetach'] = in_array('detach', $cascades);

        if (isset($mapping['type']) && $mapping['type'] === 'file') {
            $mapping['file'] = true;
        }
        if (isset($mapping['file']) && $mapping['file'] === true) {
            $this->file = $mapping['fieldName'];
            $mapping['name'] = 'file';
        }
        if (isset($mapping['distance']) && $mapping['distance'] === true) {
            $this->distance = $mapping['fieldName'];
        }
        if (isset($mapping['id']) && $mapping['id'] === true) {
            $mapping['name'] = '_id';
            $mapping['type'] = isset($mapping['type']) ? $mapping['type'] : 'id';
            $this->identifier = $mapping['fieldName'];
            if (isset($mapping['strategy'])) {
                $this->generatorOptions = isset($mapping['options']) ? $mapping['options'] : array();

                $generatorType = constant('Doctrine\ODM\MongoDB\Mapping\ClassMetadata::GENERATOR_TYPE_' . strtoupper($mapping['strategy']));
                if ($generatorType !== self::GENERATOR_TYPE_AUTO) {
                    if (isset($this->generatorOptions['type'])) {
                        $mapping['type'] = $this->generatorOptions['type'];
                    } elseif ($generatorType === ClassMetadata::GENERATOR_TYPE_INCREMENT) {
                        $mapping['type'] = 'int_id';
                    } else {
                        $mapping['type'] = 'custom_id';
                    }

                    unset($this->generatorOptions['type']);
                }

                $this->generatorType = $generatorType;
            }
        }
        if ( ! isset($mapping['nullable'])) {
            $mapping['nullable'] = false;
        }

        if (isset($mapping['reference']) && ! empty($mapping['simple']) && ! isset($mapping['targetDocument'])) {
            throw MappingException::simpleReferenceRequiresTargetDocument($this->name, $mapping['fieldName']);
        }

        if (isset($mapping['reference']) && $mapping['type'] === 'one') {
            $mapping['association'] = self::REFERENCE_ONE;
        }
        if (isset($mapping['reference']) && $mapping['type'] === 'many') {
            $mapping['association'] = self::REFERENCE_MANY;
        }
        if (isset($mapping['embedded']) && $mapping['type'] === 'one') {
            $mapping['association'] = self::EMBED_ONE;
        }
        if (isset($mapping['embedded']) && $mapping['type'] === 'many') {
            $mapping['association'] = self::EMBED_MANY;
        }

        if (isset($mapping['association']) && ! isset($mapping['targetDocument']) && ! isset($mapping['discriminatorField'])) {
            $mapping['discriminatorField'] = self::DEFAULT_DISCRIMINATOR_FIELD;
        }

        /*
        if (isset($mapping['type']) && ($mapping['type'] === 'one' || $mapping['type'] === 'many')) {
            $mapping['type'] = $mapping['type'] === 'one' ? self::ONE : self::MANY;
        }
        */
        if (isset($mapping['version'])) {
            $mapping['notSaved'] = true;
            $this->setVersionMapping($mapping);
        }
        if (isset($mapping['lock'])) {
            $mapping['notSaved'] = true;
            $this->setLockMapping($mapping);
        }
        $mapping['isOwningSide'] = true;
        $mapping['isInverseSide'] = false;
        if (isset($mapping['reference'])) {
            if (isset($mapping['inversedBy']) && $mapping['inversedBy']) {
                $mapping['isOwningSide'] = true;
                $mapping['isInverseSide'] = false;
            }
            if (isset($mapping['mappedBy']) && $mapping['mappedBy']) {
                $mapping['isInverseSide'] = true;
                $mapping['isOwningSide'] = false;
            }
            if (!isset($mapping['orphanRemoval'])) {
                $mapping['orphanRemoval'] = false;
            }
        }

        $this->fieldMappings[$mapping['fieldName']] = $mapping;
        if (isset($mapping['association'])) {
            $this->associationMappings[$mapping['fieldName']] = $mapping;
        }

        return $mapping;
    }
1282872
public function addNamedNativeQuery(array $queryMapping)
    {
        if (!isset($queryMapping['name'])) {
            throw MappingException::nameIsMandatoryForQueryMapping($this->name);
        }

        if (isset($this->namedNativeQueries[$queryMapping['name']])) {
            throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']);
        }

        if (!isset($queryMapping['query'])) {
            throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']);
        }

        if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) {
            throw MappingException::missingQueryMapping($this->name, $queryMapping['name']);
        }

        $queryMapping['isSelfClass'] = false;
        if (isset($queryMapping['resultClass'])) {

            if ($queryMapping['resultClass'] === '__CLASS__') {

                $queryMapping['isSelfClass'] = true;
                $queryMapping['resultClass'] = $this->name;
            }

            $queryMapping['resultClass'] = $this->fullyQualifiedClassName($queryMapping['resultClass']);
            $queryMapping['resultClass'] = ltrim($queryMapping['resultClass'], '\\');
        }

        $this->namedNativeQueries[$queryMapping['name']] = $queryMapping;
    }