private static function resolveField(ExecutionContext $exeContext, ObjectType $parentType, $source, $fieldNodes, $path)
{
$fieldNode = $fieldNodes[0];
$fieldName = $fieldNode->name->value;
$fieldDef = self::getFieldDef($exeContext->schema, $parentType, $fieldName);
if (!$fieldDef) {
return self::$UNDEFINED;
}
$returnType = $fieldDef->getType();
// The resolve function's optional third argument is a collection of
// information about the current execution state.
$info = new ResolveInfo(['fieldName' => $fieldName, 'fieldNodes' => $fieldNodes, 'returnType' => $returnType, 'parentType' => $parentType, 'path' => $path, 'schema' => $exeContext->schema, 'fragments' => $exeContext->fragments, 'rootValue' => $exeContext->rootValue, 'operation' => $exeContext->operation, 'variableValues' => $exeContext->variableValues]);
if (isset($fieldDef->resolveFn)) {
$resolveFn = $fieldDef->resolveFn;
} else {
if (isset($parentType->resolveFieldFn)) {
$resolveFn = $parentType->resolveFieldFn;
} else {
$resolveFn = self::$defaultFieldResolver;
}
}
// The resolve function's optional third argument is a context value that
// is provided to every resolve function within an execution. It is commonly
// used to represent an authenticated user, or request-specific caches.
$context = $exeContext->contextValue;
// Get the resolve function, regardless of if its result is normal
// or abrupt (error).
$result = self::resolveOrError($exeContext, $fieldDef, $fieldNode, $resolveFn, $source, $context, $info);
$result = self::completeValueCatchingError($exeContext, $returnType, $fieldNodes, $info, $path, $result);
return $result;
}