You are here

public function ExampleSchema::getResolverRegistry in GraphQL 8.4

Retrieves the resolver registry.

@todo Instead, this should be configuration.

Return value

\Drupal\graphql\GraphQL\ResolverRegistryInterface The resolver registry.

Overrides SchemaPluginInterface::getResolverRegistry

File

examples/graphql_example/src/Plugin/GraphQL/Schema/ExampleSchema.php, line 21

Class

ExampleSchema
Plugin annotation @Schema( id = "example", name = "Example schema" )

Namespace

Drupal\graphql_examples\Plugin\GraphQL\Schema

Code

public function getResolverRegistry() {
  $builder = new ResolverBuilder();
  $registry = new ResolverRegistry();
  $this
    ->addQueryFields($registry, $builder);
  $this
    ->addArticleFields($registry, $builder);

  // Re-usable connection type fields.
  $this
    ->addConnectionFields('ArticleConnection', $registry, $builder);
  return $registry;
}