<?php
namespace App\EventListener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class AppEventListener implements EventSubscriberInterface
{
public function __construct($container) {
$this->container = $container;
}
public static function getSubscribedEvents(): array
{
return [
RequestEvent::class => 'onKernelRequest',
];
}
public function onKernelRequest(RequestEvent $event)
{
// $apiManager = $this->container->get('App\Services\EditeurManager');
$session = $this->container->get('session');
$json = file_get_contents('./../editorConfig/datas.json');
$json = json_decode($json, true);
$session->set('dataJson', $json);
$formatImage = file_get_contents('./../editorConfig/format_image.json');
$formatImage = json_decode($formatImage, true);
$session->set('formatImage', $json);
}
}