Transform a list of arguments into their corresponding php class and validate them.

@param array       $mapping
@param mixed       $data
@param ResolveInfo $info

@return array
487340
public function getArguments(array $mapping, $data, ResolveInfo $info)
    {
        $args = [];
        $exceptions = [];

        foreach ($mapping as $name => $type) {
            try {
                $value = $this->getInstanceAndValidate($type, $data[$name], $info, $name);
                $args[] = $value;
            } catch (InvalidArgumentError $exception) {
                $exceptions[] = $exception;
            }
        }

        if (!empty($exceptions)) {
            throw new InvalidArgumentsError($exceptions);
        }

        return $args;
    }
87109
public static function getParam(DataTablesMappingInterface $mapping) {

        $param = [
            ":",
            $mapping->getPrefix(),
            $mapping->getColumn(),
        ];

        return implode("", $param);
    }
991760
public function mapManyToMany(array $mapping)
    {
        $mapping['type'] = self::MANY_TO_MANY;
        $mapping = $this->_validateAndCompleteManyToManyMapping($mapping);
        $this->_storeAssociationMapping($mapping);
    }
163170
private function renderInfoWindow(Map $map, InfoWindow $infoWindow, $position = true)
    {
        return $this->getFormatter()->renderContainerAssignment(
            $map,
            $this->infoWindowRenderer->render($infoWindow, $position),
            'overlays.info_windows',
            $infoWindow
        );
    }
786394
public function parse($name, $data, Map $map)
    {
        if (is_array($data)) {
            return $this->complexRoute($name, $data, $map);
        }
        return $map->get($name, $data);
    }
158724
public Optional<Err> validate(Framework.Mapping<?> mapping, Map<String, String> data) {
        return validate(mapping, data, "");
    }
324701
protected function resolveVars(&$vars, &$data, array &$data_pointer = [])
    {
        if (is_object($vars)) {
            if (property_exists($vars, '$ref') && is_string($vars->{'$ref'})) {
                $ref = $vars->{'$ref'};
                $relative = JsonPointer::parseRelativePointer($ref, true);
                if ($relative === null) {
                    $resolved = JsonPointer::getDataByPointer($data, $ref, $this, false);
                } else {
                    if (!JsonPointer::isEscapedPointer($ref)) {
                        throw new InvalidJsonPointerException($ref);
                    }
                    $resolved = JsonPointer::getDataByRelativePointer($data, $relative, $data_pointer, $this);
                }
                if ($resolved === $this) {
                    throw new InvalidJsonPointerException($ref);
                }
                if (is_array($resolved) && property_exists($vars, '$each') && is_object($vars->{'$each'})) {
                    $pointer = $relative['pointer'] ?? [];
                    foreach ($resolved as $index => &$item) {
                        $copy = $this->deepClone($vars->{'$each'});
                        $pointer[] = $index;
                        $this->resolveVars($copy,$data,$pointer);
                        array_pop($pointer);
                        $item = $copy;
                        unset($copy, $item, $index);
                    }
                    unset($pointer);
                }
                $vars = $resolved;
                return;
            }
        } elseif (!is_array($vars)) {
            return;
        }

        foreach ($vars as $name => &$var) {
            if (is_array($var) || is_object($var)) {
                $this->resolveVars($var, $data, $data_pointer);
            }
            unset($var);
        }
    }
1303857
public function invoke($instance, string $method, array $data)
    {
        // get the parameters
        $parameters = $this->resolveMethodParameters($instance, $method, $data, true);

        // get the reflection of method
        $reflection = new ReflectionMethod(get_class($instance), $method);

        // allow access
        $reflection->setAccessible(true);

        // execute the method
        return $reflection->invokeArgs($instance, $parameters);
    }
787087
private function populateObject(Type $type, $data, $multiple = false, ResolveInfo $info)
    {
        if (!$data) {
            return $data;
        }

        if ($multiple) {
            return \array_map(function ($data) use ($type, $info) {
                return $this->populateObject($type, $data, false, $info);
            }, $data);
        }

        if ($type instanceof EnumType) {
            $instance = $this->getTypeClassInstance($type->name);
            if ($instance) {
                $this->accessor->setValue($instance, 'value', $data);

                return $instance;
            } else {
                return $data;
            }
        } elseif ($type instanceof InputObjectType) {
            $instance = $this->getTypeClassInstance($type->name);
            if (!$instance) {
                return $data;
            }

            $fields = $type->getFields();

            foreach ($fields as $name => $field) {
                $fieldData = $this->accessor->getValue($data, \sprintf('[%s]', $name));

                if ($field->getType() instanceof ListOfType) {
                    $fieldValue = $this->populateObject($field->getType()->getWrappedType(), $fieldData, true, $info);
                } else {
                    $fieldValue = $this->populateObject($field->getType(), $fieldData, false, $info);
                }

                $this->accessor->setValue($instance, $name, $fieldValue);
            }

            return $instance;
        } else {
            return $data;
        }
    }
622519
public function mapOneToOne(array $mapping)
    {
        $mapping['type'] = self::ONE_TO_ONE;
        $mapping = $this->_validateAndCompleteOneToOneMapping($mapping);
        $this->_storeAssociationMapping($mapping);
    }
702420
public function generate($data)
    {
        if ($data instanceof InfoProviderInterface) {
            $data = $data->getCacheKeyInfo();
        }

        if ($this->converter && !is_string($data)) {
            $convertedData = $this->converter->convert($data);
            if ($convertedData === false) {
                throw new InvalidArgumentException($data);
            }

            $data = $convertedData;
        } elseif (!is_string($data)) {
            throw new InvalidArgumentException($data);
        }

        $cacheKey = $this->normalizer->normalize($data);

        if ($this->prefix) {
            return $this->prefix . $cacheKey;
        }

        return $cacheKey;
    }
186634
protected function _validateAndCompleteManyToManyMapping(array $mapping)
    {
        $mapping = $this->_validateAndCompleteAssociationMapping($mapping);
        if ($mapping['isOwningSide']) {
            // owning side MUST have a join table
            if ( ! isset($mapping['joinTable']['name'])) {
                $mapping['joinTable']['name'] = $this->namingStrategy->joinTableName($mapping['sourceEntity'], $mapping['targetEntity'], $mapping['fieldName']);
            }

            $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity']
                && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns'])));

            if ( ! isset($mapping['joinTable']['joinColumns'])) {
                $mapping['joinTable']['joinColumns'] = array(array(
                        'name' => $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity'], $selfReferencingEntityWithoutJoinColumns ? 'source' : null),
                        'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
                        'onDelete' => 'CASCADE'));
            }
            if ( ! isset($mapping['joinTable']['inverseJoinColumns'])) {
                $mapping['joinTable']['inverseJoinColumns'] = array(array(
                        'name' => $this->namingStrategy->joinKeyColumnName($mapping['targetEntity'], $selfReferencingEntityWithoutJoinColumns ? 'target' : null),
                        'referencedColumnName' => $this->namingStrategy->referenceColumnName(),
                        'onDelete' => 'CASCADE'));
            }

            $mapping['joinTableColumns'] = array();

            foreach ($mapping['joinTable']['joinColumns'] as &$joinColumn) {
                if (empty($joinColumn['name'])) {
                    $joinColumn['name'] = $this->namingStrategy->joinKeyColumnName($mapping['sourceEntity'], $joinColumn['referencedColumnName']);
                }

                if (empty($joinColumn['referencedColumnName'])) {
                    $joinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
                }

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

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

                if (isset($joinColumn['onDelete']) && strtolower($joinColumn['onDelete']) == 'cascade') {
                    $mapping['isOnDeleteCascade'] = true;
                }

                $mapping['relationToSourceKeyColumns'][$joinColumn['name']] = $joinColumn['referencedColumnName'];
                $mapping['joinTableColumns'][] = $joinColumn['name'];
            }

            foreach ($mapping['joinTable']['inverseJoinColumns'] as &$inverseJoinColumn) {
                if (empty($inverseJoinColumn['name'])) {
                    $inverseJoinColumn['name'] = $this->namingStrategy->joinKeyColumnName($mapping['targetEntity'], $inverseJoinColumn['referencedColumnName']);
                }

                if (empty($inverseJoinColumn['referencedColumnName'])) {
                    $inverseJoinColumn['referencedColumnName'] = $this->namingStrategy->referenceColumnName();
                }

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

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

                if (isset($inverseJoinColumn['onDelete']) && strtolower($inverseJoinColumn['onDelete']) == 'cascade') {
                    $mapping['isOnDeleteCascade'] = true;
                }

                $mapping['relationToTargetKeyColumns'][$inverseJoinColumn['name']] = $inverseJoinColumn['referencedColumnName'];
                $mapping['joinTableColumns'][] = $inverseJoinColumn['name'];
            }
        }

        $mapping['orphanRemoval'] = isset($mapping['orphanRemoval']) ? (bool) $mapping['orphanRemoval'] : false;

        if (isset($mapping['orderBy'])) {
            if ( ! is_array($mapping['orderBy'])) {
                throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy']));
            }
        }

        return $mapping;
    }
285799
protected static function findClass($mapping, $type)
    {
        if (strpos($type, '\\')) {
            return $type;
        }

        if (!isset($mapping[$type])) {
            return $type;
        }

        return $mapping[$type];
    }
912620
protected function buildValidPropertyAlias($mapping)
    {
        $aliases = $mapping->getAliasedProperties();
        foreach ($aliases as &$alias) {
            $alias = DataAttributesHelper::transformToValidMemberName($alias);
        }
        $mapping->setPropertyNameAliases($aliases);
    }
843912
protected function mappedRelationQuery($query, $method, ArgumentBag $args, $mapping)
    {
        list($target, $column) = $this->parseMappedColumn($mapping);

        if (in_array($method, ['pluck', 'value', 'aggregate', 'orderBy', 'lists'])) {
            return $this->mappedJoinQuery($query, $method, $args, $target, $column);
        }

        return $this->mappedHasQuery($query, $method, $args, $target, $column);
    }
1281896
private function mapTranslation(ClassMetadata $mapping)
    {
        $metadata = $this->getTranslatableMetadata($mapping->name);

        // Map translatable relation
        if ($metadata->targetEntity
            && $metadata->translatable
            && !$mapping->hasAssociation($metadata->translatable->name)
        ) {
            $targetMetadata = $this->getTranslatableMetadata($metadata->targetEntity);

            $mapping->mapManyToOne(array(
                'fieldName'    => $metadata->translatable->name,
                'targetEntity' => $metadata->targetEntity,
                'inversedBy'   => $targetMetadata->translations->name,
                'joinColumns'  => array(array(
                    'name'                 => 'translatable_id',
                    'referencedColumnName' => 'id',
                    'onDelete'             => 'CASCADE',
                    'nullable'             => false,
                )),
            ));
        }

        if (!$metadata->translatable) {
            return;
        }

        // Map locale field
        if (!$mapping->hasField($metadata->locale->name)) {
            $mapping->mapField(array(
                'fieldName' => $metadata->locale->name,
                'type' => 'string',
            ));
        }

        // Map unique index
        $columns = array(
            $mapping->getSingleAssociationJoinColumnName($metadata->translatable->name),
            $metadata->locale->name,
        );

        if (!$this->hasUniqueConstraint($mapping, $columns)) {
            $constraints = isset($mapping->table['uniqueConstraints']) ? $mapping->table['uniqueConstraints']: array();
            $constraints[$mapping->getTableName() . '_uniq_trans'] = array(
                'columns' => $columns,
            );

            $mapping->setPrimaryTable(array(
                'uniqueConstraints' => $constraints,
            ));
        }
    }
833116
public function type($mapping_type) {
		$args = func_get_args();
		$mapping_type = array_shift($args);
	
		//check if mapping arguments are defined
		if (empty($args))
			return $this->merge(['map.type' => $mapping_type]);
	
		return $this->merge(['map.type' => $mapping_type, 'map.params' => $args]);
	}