<?php
namespace App\EventListener;
use App\Service\AutoSaveService;
use Symfony\Component\HttpKernel\Event\RequestEvent;
class RequestListener
{
public function __construct(private AutoSaveService $autoSaveService){}
public function onKernelRequest(RequestEvent $event)
{
$request = $event->getRequest();
if ($event->isMainRequest() && $request->isMethod('GET') && $request->query->has('restore')) {
// don't do anything if it's not the main request
$data = $this->autoSaveService->restore($request->query->get('restore'));
}
elseif ($event->isMainRequest())
{
}
//if($request->server->get('HTTP_REFERER') !== )
}
}