6 declare(strict_types=1);
37 private $schemaGenerator;
42 private $jsonSerializer;
47 private $queryProcessor;
52 private $graphQlError;
57 private $resolverContext;
62 private $requestProcessor;
87 QueryFields $queryFields
90 $this->schemaGenerator = $schemaGenerator;
91 $this->jsonSerializer = $jsonSerializer;
92 $this->queryProcessor = $queryProcessor;
93 $this->graphQlError = $graphQlError;
94 $this->resolverContext = $resolverContext;
95 $this->requestProcessor = $requestProcessor;
96 $this->queryFields = $queryFields;
110 $this->requestProcessor->processHeaders(
$request);
111 $data = $this->jsonSerializer->unserialize(
$request->getContent());
117 $this->queryFields->setQuery(
$query);
118 $schema = $this->schemaGenerator->generate();
120 $result = $this->queryProcessor->process(
123 $this->resolverContext,
124 isset(
$data[
'variables']) ?
$data[
'variables'] : []
126 }
catch (\Exception $error) {
128 $result[
'errors'][] = $this->graphQlError->create($error);
131 $this->response->setBody($this->jsonSerializer->serialize(
$result))->setHeader(
134 )->setHttpResponseCode($statusCode);
135 return $this->response;
dispatch(RequestInterface $request)
__construct(Response $response, SchemaGeneratorInterface $schemaGenerator, SerializerInterface $jsonSerializer, QueryProcessor $queryProcessor, ExceptionFormatter $graphQlError, ContextInterface $resolverContext, HttpRequestProcessor $requestProcessor, QueryFields $queryFields)