@param ClassMetadataBuilder $builder
@param array                $mapping

@return Field
197211
protected function getFieldBuilder(ClassMetadataBuilder $builder, array $mapping)
    {
        return Field::make(
            $builder,
            $mapping['type'],
            $this->name
        );
    }
817647
private function convertToClassMetadataInfo($className, $mappingInformation)
    {
        $metadata = new ClassMetadataInfo($className);

        $this->convertTableName($className, $mappingInformation, $metadata);
        $this->convertColumns($className, $mappingInformation, $metadata);
        $this->convertIndexes($className, $mappingInformation, $metadata);
        $this->convertRelations($className, $mappingInformation, $metadata);

        return $metadata;
    }
486508
public static function parse($matrix, array $mapping)
    {
        $matrix = trim($matrix);
        $areas = [];

        $rows = preg_split("/\n/", $matrix);
        $rowCount = \count($rows);
        if (0 === $rowCount || 0 === \strlen($rows[0])) {
            throw new \InvalidArgumentException('Invalid template matrix, a matrix should contain at least one row');
        }

        $colCount = \strlen($rows[0]);

        foreach ($rows as $y => $row) {
            if (\strlen($row) !== $colCount && $y > 0) {
                throw new \InvalidArgumentException(sprintf('Invalid template matrix, inconsistent row length, row "%d" should have a length of "%d"', $y, $colCount));
            }

            $cells = str_split($row);
            foreach ($cells as $x => $symbol) {
                if (!\array_key_exists($symbol, $mapping)) {
                    throw new \InvalidArgumentException(sprintf('Invalid template matrix, no mapping found for symbol "%s"', $symbol));
                }
                if (!isset($areas[$symbol])) {
                    $areas[$symbol] = [
                        'x' => $x,
                        'y' => $y,
                        'width' => 1,
                        'height' => 1,
                    ];
                } else {
                    // @todo handle non adjacent cells
                    if (false) {
                        //throw new \InvalidArgumentException(sprintf('Invalid template matrix, non adjacent symbol found "%s" at row "%s", col "%s"', $symbol, $y, $x));
                    }
                    $areas[$symbol]['width'] = $x - $areas[$symbol]['x'] + 1;
                    $areas[$symbol]['height'] = $y - $areas[$symbol]['y'] + 1;
                }
            }
        }

        foreach ($areas as &$area) {
            $area['x'] = $area['x'] / $colCount * 100;
            $area['y'] = $area['y'] / $rowCount * 100;

            $area['width'] = $area['width'] / $colCount * 100;
            $area['height'] = $area['height'] / $rowCount * 100;

            $area['right'] = 100 - ($area['width'] + $area['x']);
            $area['bottom'] = 100 - ($area['height'] + $area['y']);
        }

        $containers = [];
        foreach ($areas as $symbol => $config) {
            $containers[$mapping[$symbol]] = $config;
        }

        return $containers;
    }
80190
protected function mapMapping(array $record, Mapping $mapping, $context = null, $key = null)
    {
        $mapped = $this->mapFragment($record, $mapping->toArray(), $context, $key);

        if ($mapping->isWrapped()) {
            // Unwrap.
            return $mapped[0];
        }

        return $mapped;
    }
842026
public static function create($type, ClassMetadataBuilder $builder)
    {
        if (isset(static::$map[$type])) {
            return new static::$map[$type]($builder);
        }

        throw new InvalidArgumentException("Inheritance type [{$type}] does not exist. SINGLE_TABLE and JOINED are support");
    }
1348779
protected function doMap(
        $source,
        $destination,
        MappingInterface $mapping,
        array $context = []
    ) {
        $propertyNames = $mapping->getTargetProperties($destination, $source);
        foreach ($propertyNames as $propertyName) {
            $mappingOperation = $mapping->getMappingOperationFor($propertyName);

            if ($mappingOperation instanceof MapperAwareOperation) {
                $mappingOperation->setMapper($this);
            }
            if ($mappingOperation instanceof ContextAwareOperation) {
                $mappingOperation->setContext($context);
            }

            $mappingOperation->mapProperty(
                $propertyName,
                $source,
                $destination
            );
        }

        return $destination;
    }
1316759
protected static function metaForId(ClassMetadataBuilder $builder): void
    {
        $builder->createField('id', MappingHelper::TYPE_UUID)
                ->makePrimaryKey()
                ->nullable(false)
                ->unique(true)
                ->generatedValue('NONE')
                ->build();
    }
322030
public function mapField(array $mapping)
    {
        $this->_validateAndCompleteFieldMapping($mapping);
        $this->assertFieldNotMapped($mapping['fieldName']);

        $this->fieldMappings[$mapping['fieldName']] = $mapping;
    }
46627
public function addAuthorizationMapping($entity, $mapping)
    {
        $classname = get_class($entity);
        if (!isset($this->rights[$classname])) {
            $this->buildRights($classname);
        }

        $this->rights[$classname] = array_merge($this->rights[$classname], $mapping);

        return $this;
    }
427461
public static function make(ClassMetadataBuilder $builder, $type, $name)
    {
        $type = Type::getType($type);

        $field = $builder->createField($name, $type->getName());

        return new static($field, $builder, $type, $name);
    }
768823
public function mapEmbedded(array $mapping)
    {
        $this->assertFieldNotMapped($mapping['fieldName']);

        $this->embeddedClasses[$mapping['fieldName']] = array(
            'class' => $this->fullyQualifiedClassName($mapping['class']),
            'columnPrefix' => $mapping['columnPrefix'],
            'declaredField' => isset($mapping['declaredField']) ? $mapping['declaredField'] : null,
            'originalField' => isset($mapping['originalField']) ? $mapping['originalField'] : null,
        );
    }
67519
protected function setDefaults($metaType, $mapping)
    {
        if (!is_array($mapping)) {
            $mapping = [];
        }

        $mapping = $this->setRootDefault('attributes', $mapping);
        $mapping = $this->setRootDefault('embeds', $mapping);
        $mapping = $this->setRootDefault('mixins', $mapping);
        if ('embed' === $metaType) {
            return $mapping;
        }

        $mapping = $this->setRootDefault('relationships', $mapping);
        if ('mixin' === $metaType) {
            return $mapping;
        }
        $this->setRootDefault('entity', $mapping);

        if (!isset($mapping['entity']['persistence']) || !is_array($mapping['entity']['persistence'])) {
            $mapping['entity']['persistence'] = [];
        }

        if (!isset($mapping['entity']['search']) || !is_array($mapping['entity']['search'])) {
            $mapping['entity']['search'] = [];
        }
        return $mapping;
    }
1087181
protected function setSearch(Metadata\EntityMetadata $metadata, array $mapping)
    {
        $clientKey = isset($mapping['key']) ? $mapping['key'] : null;
        if (null === $clientKey) {
            // Search is not enabled for this model.
            return $metadata;
        }

        $factory = $this->getSearchMetadataFactory($clientKey);

        $search = $factory->createInstance($mapping);

        $metadata->setSearch($search);
        return $metadata;
    }
991760
public function mapManyToMany(array $mapping)
    {
        $mapping['type'] = self::MANY_TO_MANY;
        $mapping = $this->_validateAndCompleteManyToManyMapping($mapping);
        $this->_storeAssociationMapping($mapping);
    }
211338
private function buildMapping($mapping)
    {
        foreach ($mapping as $field => $type) {
            $mapping[$field] = $this->buildType($type);
        }

        return $mapping;
    }
1090368
public function exposeEnvironmentIntoContainer(ContainerBuilder $container, array $mappings): ContainerBuilder
    {
        foreach ($mappings as $environmentKey => $consulPath) {
            $container->setParameter("env({$environmentKey})", getenv($environmentKey));
        }

        return $container;
    }
1337876
protected function getPropertiesFromMapping(Mapping $mapping)
    {
        $properties = array_merge(
            array_combine($mapping->getProperties(), $mapping->getProperties()),
            $mapping->getAliasedProperties()
        );

        return $properties;
    }