public function QueryRouteEnhancer::enhance in GraphQL 8.4
Same name and namespace in other branches
- 8.3 src/Routing/QueryRouteEnhancer.php \Drupal\graphql\Routing\QueryRouteEnhancer::enhance()
Throws
\GraphQL\Server\RequestError
File
- src/
Routing/ QueryRouteEnhancer.php, line 35
Class
- QueryRouteEnhancer
- Adds GraphQL operation information to the Symfony route being resolved.
Namespace
Drupal\graphql\RoutingCode
public function enhance(array $defaults, Request $request) {
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
if (!$this
->applies($route)) {
return $defaults;
}
$helper = new Helper();
$method = $request
->getMethod();
$body = $this
->extractBody($request);
$query = $this
->extractQuery($request);
$operations = $helper
->parseRequestParams($method, $body, $query);
return $defaults + [
'operations' => $operations,
];
}