class QueryResult in GraphQL 8.3
Hierarchy
- class \Drupal\graphql\GraphQL\Execution\QueryResult extends \GraphQL\Executor\ExecutionResult implements RefinableCacheableDependencyInterface uses RefinableCacheableDependencyTrait
Expanded class hierarchy of QueryResult
1 file declares its use of QueryResult
- QueryResultAssertionTrait.php in tests/
src/ Traits/ QueryResultAssertionTrait.php
File
- src/
GraphQL/ Execution/ QueryResult.php, line 10
Namespace
Drupal\graphql\GraphQL\ExecutionView source
class QueryResult extends ExecutionResult implements RefinableCacheableDependencyInterface {
use RefinableCacheableDependencyTrait;
/**
* QueryResult constructor.
*
* @param array $data
* Result data.
* @param array $errors
* Errors collected during execution.
* @param array $extensions
* User specified array of extensions.
* @param \Drupal\Core\Cache\CacheableDependencyInterface $metadata
* The cache metadata collected during query execution.
*/
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);
}
/**
* Don't serialize errors, since they might contain closures.
*
* @return string[]
* The property names to serialize.
*/
public function __sleep() {
// TODO: Find a better way to solve this.
return array_filter(array_keys(get_object_vars($this)), function ($prop) {
return $prop != 'errors';
});
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableDependencyTrait:: |
protected | property | Cache contexts. | |
CacheableDependencyTrait:: |
protected | property | Cache max-age. | |
CacheableDependencyTrait:: |
protected | property | Cache tags. | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
public | function | 3 | |
CacheableDependencyTrait:: |
protected | function | Sets cacheability; useful for value object constructors. | |
QueryResult:: |
public | function | QueryResult constructor. | |
QueryResult:: |
public | function | Don't serialize errors, since they might contain closures. | |
RefinableCacheableDependencyTrait:: |
public | function | 1 | |
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function | ||
RefinableCacheableDependencyTrait:: |
public | function |