You are here

public function QueryResult::__construct in GraphQL 8.3

QueryResult constructor.

Parameters

array $data: Result data.

array $errors: Errors collected during execution.

array $extensions: User specified array of extensions.

\Drupal\Core\Cache\CacheableDependencyInterface $metadata: The cache metadata collected during query execution.

File

src/GraphQL/Execution/QueryResult.php, line 25

Class

QueryResult

Namespace

Drupal\graphql\GraphQL\Execution

Code

public function __construct(array $data = null, array $errors = [], array $extensions = [], CacheableDependencyInterface $metadata = NULL) {
  $this->data = $data;
  $this->errors = $errors;
  $this->extensions = $extensions;

  // If no cache metadata was given, assume this result is not cacheable.
  $this
    ->addCacheableDependency($metadata);
}