You are here

public function ResolverBuilder::context in GraphQL 8.4

Add a context that is available for further resolvers.

Parameters

string $name:

\Drupal\graphql\GraphQL\Resolver\ResolverInterface $source:

Return value

\Drupal\graphql\GraphQL\Resolver\Tap

File

src/GraphQL/ResolverBuilder.php, line 92

Class

ResolverBuilder
Wires and maps different resolvers together to build the GraphQL tree.

Namespace

Drupal\graphql\GraphQL

Code

public function context($name, ResolverInterface $source = NULL) {
  $callback = new SourceContext($name, $source);
  return $this
    ->tap($callback);
}