$this->sessionOptions =
$sessionOptions;
} public function onKernelRequest(RequestEvent
$event): void
{ if (!
$event->
isMainRequest()) { return;
} $request =
$event->
getRequest();
if (!
$request->
hasSession()) { $request->
setSessionFactory(function D
) use ($request) { // Prevent calling `$this->getSession()` twice in case the Request (and the below factory) is cloned
static $sess;
if (!
$sess) { $sess =
$this->
getSession();
$request->
setSession($sess);
/*
* For supporting sessions in php runtime with runners like roadrunner or swoole, the session
* cookie needs to be read from the cookie bag and set on the session storage.
*
* Do not set it when a native php session is active.
*/