src/EventSubscriber/DataTransformerDependencySubscriber.php line 25

Open in your IDE?
  1. <?php
  2. /**
  3.  * @license SILK SOFTWARE HOUSE SP Z O O
  4.  */
  5. namespace App\EventSubscriber;
  6. use App\Decoder\Interfaces\DecoderInterface;
  7. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  8. use Symfony\Component\HttpKernel\Event\ControllerEvent;
  9. use Symfony\Component\HttpKernel\Event\RequestEvent;
  10. use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  11. use Symfony\Component\HttpKernel\KernelEvents;
  12. /**
  13.  * Class RequestDecryptingSubscriber.
  14.  */
  15. class DataTransformerDependencySubscriber implements EventSubscriberInterface
  16. {
  17.     const ACTIONS_SUBSCRIBED = [
  18.         'device_measurement_chart_type',
  19.     ];
  20.     public function onKernelController(ControllerEvent $event)
  21.     {
  22.         $controller $event->getController();
  23.         $request $event->getRequest();
  24.         $route $request->get('_route');
  25.         // when a controller class defines multiple action methods, the controller
  26.         // is returned as [$controllerInstance, 'methodName']
  27.         if (in_array($routeself::ACTIONS_SUBSCRIBED)) {
  28.             dump($route);
  29.         }
  30.     }
  31.     public static function getSubscribedEvents()
  32.     {
  33.         return [
  34.             KernelEvents::CONTROLLER => 'onKernelController',
  35.         ];
  36.     }
  37. }