Given a GraphQL type and an array of data, populate corresponding object recursively
using annoted classes.

@param string      $argType
@param mixed       $data
@param ResolveInfo $info

@return mixed
558091
public function getInstanceAndValidate(string $argType, $data, ResolveInfo $info, string $argName)
    {
        $isRequired = '!' === $argType[\strlen($argType) - 1];
        $isMultiple = '[' === $argType[0];
        $endIndex = ($isRequired ? 1 : 0) + ($isMultiple ? 1 : 0);
        $type = \substr($argType, $isMultiple ? 1 : 0, $endIndex > 0 ? -$endIndex : \strlen($argType));

        $result = $this->populateObject($this->getType($type, $info), $data, $isMultiple, $info);
        $errors = [];
        if (\is_object($result) && $this->validator) {
            $errors = $this->validator->validate($result);
        }

        if (\count($errors) > 0) {
            throw new InvalidArgumentError($argName, $errors);
        } else {
            return $result;
        }
    }
647768
public function type(string $type): ResolverInterface
    {
        $this->type = DataType::make($type);

        return $this;
    }
993408
private function resolveParams($params, $args)
    {
        foreach ($params as $param) {
            $class = $param->getClass();

            // if the param is not a class, check $args for the value
            if (\is_null($class)) {
                $this->resolveParam($args, $param);
                continue;
            }

            $className = $class->getName();

            // if the class exists in the container, inject it
            if ($this->resolveFromContainer($className)) {
                continue;
            }

            if ($class->isInterface()) {
                throw new ConcreteClassNotFoundException("$className is an interface with no bound implementation.");
            }

            // else the param is a class, so run $this->resolve on it
            $this->addToStack($this->resolve($className, $args));
        }
    }
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;
    }
580477
public function converter(callable $callback, string ...$types): ResolverInterface
    {
        $rule = RuleFactory::converter($callback, ...$types);
        $this->addRule($rule, self::LOW_PRIORITY);

        return $this;
    }
818447
private Type resolveType(Type beanType, Type beanType2, Type type) {
        if (type instanceof ParameterizedType) {
            if (beanType instanceof ParameterizedType) {
                return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);
            }
            if (beanType instanceof Class<?>) {
                return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
            }
        }

        if (type instanceof TypeVariable<?>) {
            if (beanType instanceof ParameterizedType) {
                return resolveTypeParameter((ParameterizedType) beanType, beanType2, (TypeVariable<?>) type);
            }
            if (beanType instanceof Class<?>) {
                return resolveType(((Class<?>) beanType).getGenericSuperclass(), beanType2, type);
            }
        }
        return type;
    }
437801
public static function SelectValuesWithArgAndResolver( $xpath, $resolver, $arg )
	{
		/**
		 * @var XPath2NodeIterator $iter
		 */
		$iter = XPath2NodeIterator::Create( Compile( $xpath, $resolver )->EvaluateWithProperties( null, $arg ) );
		while ( $iter->MoveNext() )
			yield $iter->getCurrent()->GetTypedValue();
	}
636724
public function createEntity(array $data = [], EntityInterface $parent_entity = null, $apply_default_values = false)
    {
        $implementor = $this->getEntityImplementor();

        if (!class_exists($implementor, true)) {
            throw new InvalidTypeException(
                "Unable to resolve the given entity implementor '$implementor' upon entity creation request."
            );
        }

        return new $implementor($this, $data, $parent_entity, $apply_default_values);
    }
340110
private function resolveTypedObject($type, Context $context = null)
    {
        return new Object_($this->fqsenResolver->resolve($type, $context));
    }
1308656
public function loadClassMetadata(LoadClassMetadataEventArgs $args) {
		/**
		 * @var \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadata
		 */
		$classMetadata = $args->getClassMetadata();
		
		// Do not re-apply the prefix in an inheritance hierarchy.
		if($classMetadata->isInheritanceTypeSingleTable() && !$classMetadata->isRootEntity()) {
			return;
		}
		
		$prefix = $classMetadata->namespace;
		if(!preg_match('/([^\\\\]+)Bundle/i', $classMetadata->namespace, $prefix)) {
			return;
		}

		$prefix = strtolower($prefix[1]) . '_';
		
		$classMetadata->setPrimaryTable(array(
			'name' => $prefix . $classMetadata->getTableName() 
		));

		if($args->getEntityManager()->getConnection()->getDatabasePlatform() instanceof SqlitePlatform && array_key_exists('indexes', $classMetadata->table)) {
			$indexes = array();
			foreach($classMetadata->table['indexes'] as $name => $params) {
				$indexes[$prefix . $classMetadata->getTableName() . '_' . $name] = $params;
			}
			$classMetadata->table['indexes'] = $indexes;
		}
		
		foreach($classMetadata->getAssociationMappings() as $fieldName => $mapping) {
			if($mapping['type'] == \Doctrine\ORM\Mapping\ClassMetadataInfo::MANY_TO_MANY && isset($classMetadata->associationMappings[$fieldName]['joinTable']['name'])) {
				if(isset($classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']) && $classMetadata->associationMappings[$fieldName]['joinTable']['prefixed']) {
					continue;
				}
				
				$mappedTableName = $classMetadata->associationMappings[$fieldName]['joinTable']['name'];
				$classMetadata->associationMappings[$fieldName]['joinTable']['name'] = $prefix . $mappedTableName;
				$classMetadata->associationMappings[$fieldName]['joinTable']['prefixed'] = true;
			}
		}
	}
208569
public function parseFieldsMap($data = null, $type = Model::TO_DB)
	{
		if (null === $data)
		{
			$data = $this->data;
		}
		foreach ($this->fieldsMap as $key => $value)
		{
			if (Model::TO_DB === $type)
			{
				if (isset($data[$key]))
				{
					$data[$value] = $data[$key];
					unset($data[$key]);
				}
			}
			else
			{
				if (isset($data[$value]))
				{
					$data[$key] = $data[$value];
					unset($data[$value]);
				}
			}
		}
		return $data;
	}
918498
public function buildTree($type, array $data)
    {
        $node = $this->resolver->resolve($type, $data);

        $fieldMap = $this->knowledge->compareFields($type, $data);


        $this->filler->fillNode($node, $fieldMap);

        return $node;
    }
126805
protected function resolveReturnType(Type $type, \Closure $resolver) : Type {
        if ($type instanceof UnionType) {
            $old = $type->getTypes();
            $new = [];
            foreach ($old as $subtype)
                $new[] = $resolver($subtype);
            return ($old===$new) ? $type : new UnionType($new);
        }
        return $resolver($type);
    }
1127858
public static function loadData($type, $data)
    {
        if ($data === false || strlen($data) == 0) {
            return false;
        }
        $tmp = unpack($type, $data);

        return current($tmp);
    }
394329
public function resolve($value, array $args, $context, ResolveInfo $info)
    {
        $result = call_user_func_array(
            $this->connectionResolver,
            func_get_args()
        );

        if (!$result instanceof SS_List) {
            throw new \Exception('Connection::resolve() must resolve to a SS_List instance.');
        }

        return $this->resolveList($result, $args, $context, $info);
    }
563955
private function convertCompositeToPg($data, TypeInterface $type)
    {
        $mapping = $this->getMapping($type);

        if ($normalizer = $this->getNormalizer($type)) {
            $data = $normalizer->toPg($data, [
                'mapping' => $mapping,
            ]);
        }

        $fragments = [];

        foreach ($mapping as $field => $fieldType) {
            if (!isset($data[$field])) {
                $fragments[$field] = $fieldType instanceof ArrayType ? new Set([], $fieldType) : new Value('null');

                continue;
            }

            $fragments[$field] = $this->toPg($data[$field], $fieldType);
        }

        return new Row($fragments, $type);
    }
743233
public function loadClassMetadata(LoadClassMetadataEventArgs $args)
    {
        /** @var ClassMetadata $cm */
        $class = $args->getClassMetadata();

        foreach ($class->discriminatorMap as $key => $className) {
            if (isset($this->resolveTargetEntities[$className])) {
                $targetEntity = $this->resolveTargetEntities[$className];

                $class->discriminatorMap[$key] = $targetEntity;
            }
        }

        foreach ($class->getDeclaredPropertiesIterator() as $association) {
            if ($association instanceof AssociationMetadata &&
                isset($this->resolveTargetEntities[$association->getTargetEntity()])) {
                $targetEntity = $this->resolveTargetEntities[$association->getTargetEntity()];

                $association->setTargetEntity($targetEntity);
            }
        }

        foreach ($this->resolveTargetEntities as $interface => $targetEntity) {
            if ($targetEntity === $class->getClassName()) {
                $args->getEntityManager()->getMetadataFactory()->setMetadataFor($interface, $class);
            }
        }
    }