mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 15:59:24 +03:00
Server: use proper batching helper
This commit is contained in:
parent
919cf80240
commit
49208d758d
@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace GraphQL\Server;
|
namespace GraphQL\Server;
|
||||||
|
|
||||||
use GraphQL\Error\InvariantViolation;
|
|
||||||
use GraphQL\Utils\Utils;
|
|
||||||
use GraphQL\Executor\ExecutionResult;
|
use GraphQL\Executor\ExecutionResult;
|
||||||
use GraphQL\Executor\Promise\Promise;
|
use GraphQL\Executor\Promise\Promise;
|
||||||
|
|
||||||
@ -58,13 +56,10 @@ class StandardServer
|
|||||||
}
|
}
|
||||||
$this->helper->assertValidRequest($parsedBody);
|
$this->helper->assertValidRequest($parsedBody);
|
||||||
|
|
||||||
$batched = is_array($parsedBody);
|
if (is_array($parsedBody)) {
|
||||||
|
return $this->helper->executeBatch($this->config, $parsedBody);
|
||||||
$result = [];
|
} else {
|
||||||
foreach ((array) $parsedBody as $index => $operationParams) {
|
return $this->helper->executeOperation($this->config, $parsedBody);
|
||||||
$result[] = $this->helper->executeOperation($this->config, $operationParams);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $batched ? $result : $result[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user