You are here

protected function Server::getRootValue in GraphQL 8.4

Returns to root value to use when resolving queries against the schema.

@todo Handle this through configuration (e.g. a context value).

May return a callable to resolve the root value at run-time based on the provided query parameters / operation.



public function getRootValue() {
  return function (OperationParams $params, DocumentNode $document, $operation) {
    // Dynamically return a root value based on the current query.
  };
}

Return value

mixed|callable The root value for query execution or a callable factory.

File

src/Entity/Server.php, line 254

Class

Server
The main GraphQL configuration and request entry point.

Namespace

Drupal\graphql\Entity

Code

protected function getRootValue() {
  return NULL;
}