You are here

public function SourceContext::resolve in GraphQL 8.4

Resolve values for the fields.

Parameters

mixed $value:

mixed $args:

\Drupal\graphql\GraphQL\Execution\ResolveContext $context:

\GraphQL\Type\Definition\ResolveInfo $info:

\Drupal\graphql\GraphQL\Execution\FieldContext $field:

Return value

mixed

Overrides ResolverInterface::resolve

File

src/GraphQL/Resolver/SourceContext.php, line 42

Class

SourceContext
Resolves by setting the value as context with the given name.

Namespace

Drupal\graphql\GraphQL\Resolver

Code

public function resolve($value, $args, ResolveContext $context, ResolveInfo $info, FieldContext $field) {
  $source = $this->source ?? new ParentValue();
  $context = $source
    ->resolve($value, $args, $context, $info, $field);
  $field
    ->setContextValue($this->name, $context);
  return $context;
}