src/EventListener/AppEventListener.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\HttpFoundation\Session\Session;
  5. use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
  6. use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  7. use Symfony\Component\HttpKernel\Event\RequestEvent;
  8. class AppEventListener implements EventSubscriberInterface
  9. {
  10.     public function __construct($container) {
  11.         $this->container $container;
  12.     }
  13.     public static function getSubscribedEvents(): array
  14.     {
  15.         return [
  16.             RequestEvent::class => 'onKernelRequest',
  17.         ];
  18.     }
  19.     public function onKernelRequest(RequestEvent $event)
  20.     {
  21.         // $apiManager = $this->container->get('App\Services\EditeurManager');
  22.         $session $this->container->get('session');
  23.         $json file_get_contents('./../editorConfig/datas.json');
  24.         $json json_decode($jsontrue);
  25.         $session->set('dataJson'$json);
  26.         $formatImage file_get_contents('./../editorConfig/format_image.json');
  27.         $formatImage json_decode($formatImagetrue);
  28.         $session->set('formatImage'$json);
  29.         
  30.     }
  31. }