class SubrequestSubscriber in GraphQL 8.3
Same name and namespace in other branches
- 8.4 src/EventSubscriber/SubrequestSubscriber.php \Drupal\graphql\EventSubscriber\SubrequestSubscriber
Remap artificial requests to subrequest extraction controller.
Hierarchy
- class \Drupal\graphql\EventSubscriber\SubrequestSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of SubrequestSubscriber
1 string reference to 'SubrequestSubscriber'
1 service uses SubrequestSubscriber
File
- src/
EventSubscriber/ SubrequestSubscriber.php, line 12
Namespace
Drupal\graphql\EventSubscriberView source
class SubrequestSubscriber implements EventSubscriberInterface {
/**
* Handle kernel request events.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
* The kernel event object.
*/
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');
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
KernelEvents::REQUEST => 'onKernelRequest',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SubrequestSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
SubrequestSubscriber:: |
public | function | Handle kernel request events. |