You are here

public function SubrequestSubscriber::onKernelRequest in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 src/EventSubscriber/SubrequestSubscriber.php \Drupal\graphql\EventSubscriber\SubrequestSubscriber::onKernelRequest()

Handle kernel request events.

Parameters

\Symfony\Component\HttpKernel\Event\GetResponseEvent $event: The kernel event object.

File

src/EventSubscriber/SubrequestSubscriber.php, line 20

Class

SubrequestSubscriber
Remap artificial requests to subrequest extraction controller.

Namespace

Drupal\graphql\EventSubscriber

Code

public function onKernelRequest(GetResponseEvent $event) {
  $request = $event
    ->getRequest();
  if ($request->attributes
    ->has('_graphql_subrequest')) {
    $request->attributes
      ->set('_graphql_controller', $request->attributes
      ->get('_controller'));
    $request->attributes
      ->set('_controller', '\\Drupal\\graphql\\Controller\\SubrequestExtractionController:extract');
  }
}