public function Executor::doExecute in GraphQL 8.4
File
- src/
GraphQL/ Execution/ Executor.php, line 214
Class
- Executor
- Executes GraphQL queries with cache lookup.
Namespace
Drupal\graphql\GraphQL\ExecutionCode
public function doExecute() : Promise {
$server = $this->context
->getServer();
$operation_def = AST::getOperationAST($this->document, $this->operation);
if ($operation_def && $operation_def->operation === 'query' && !!$server
->get('caching')) {
return $this
->doExecuteCached($this
->cachePrefix());
}
// This operation can never be cached because we are either in development
// mode (caching is disabled) or this is a non-cacheable operation.
return $this
->doExecuteUncached()
->then(function ($result) {
$this->context
->mergeCacheMaxAge(0);
$result = new CacheableExecutionResult($result->data, $result->errors, $result->extensions);
$result
->addCacheableDependency($this->context);
return $result;
});
}