mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
GraphQL\Server: set PromiseAdapter before executing query
This commit is contained in:
parent
d10e933a00
commit
c18cd16960
@ -4,6 +4,7 @@ namespace GraphQL;
|
||||
use GraphQL\Error\Error;
|
||||
use GraphQL\Error\InvariantViolation;
|
||||
use GraphQL\Executor\ExecutionResult;
|
||||
use GraphQL\Executor\Executor;
|
||||
use GraphQL\Executor\Promise\PromiseAdapter;
|
||||
use GraphQL\Language\AST\DocumentNode;
|
||||
use GraphQL\Language\Parser;
|
||||
@ -482,6 +483,12 @@ class Server
|
||||
});
|
||||
}
|
||||
|
||||
if ($this->promiseAdapter) {
|
||||
// TODO: inline GraphQL::executeAndReturnResult and pass promise adapter to executor constructor directly
|
||||
$promiseAdapter = Executor::getPromiseAdapter();
|
||||
Executor::setPromiseAdapter($this->promiseAdapter);
|
||||
}
|
||||
|
||||
$result = GraphQL::executeAndReturnResult(
|
||||
$this->getSchema(),
|
||||
$query,
|
||||
@ -491,6 +498,10 @@ class Server
|
||||
$operationName
|
||||
);
|
||||
|
||||
if (isset($promiseAdapter)) {
|
||||
Executor::setPromiseAdapter($promiseAdapter);
|
||||
}
|
||||
|
||||
// Add details about original exception in error entry (if any)
|
||||
if ($this->debug & static::DEBUG_EXCEPTIONS) {
|
||||
$result->setErrorFormatter([$this, 'formatError']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user