EventListener/SessionBackup.php
public function onKernelRequest(GetResponseEvent $event)
    {
        $session = $event->getRequest()->getSession();

        if ($session === null || !$session->isStarted()) {
            return;
        }

        if (!$event->getRequest()->cookies->has('yc-session-id')) {
            $event->getRequest()->cookies->set('yc-session-id', $session->getId());
        }
    }
public function onKernelRequest(GetResponseEvent $event)
    {
        $session = $event->getRequest()->getSession();

        if ($session === null || !$session->isStarted()) {
            return;
        }

        if (!$event->getRequest()->cookies->has('yc-session-id')) {
            $event->getRequest()->cookies->set('yc-session-id', $session->getId());
        }
    }
public function onKernelRequest ( GetResponseEvent $ event ) { $ session = $ event -> getRequest ( ) -> getSession ( ) ; if ( $ session === null || ! $ session -> isStarted ( ) ) { return ; } if ( ! $ event -> getRequest ( ) -> cookies -> has ( 'yc-session-id' ) ) { $ event -> getRequest ( ) -> cookies -> set ( 'yc-session-id' , $ session -> getId ( ) ) ; } }
Creates a backup of current sessionId in case of sessionId change,
we need this value to identify user on YooChoose side.
Be aware that session is automatically destroyed when user logs off,
in this case the new sessionId will be set. This issue can be treated
as a later improvement as it's not required by YooChoose to work correctly.

@param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event
Creates a backup of current sessionId in case of sessionId change we need this value to identify user on YooChoose side . Be aware that session is automatically destroyed when user logs off in this case the new sessionId will be set . This issue can be treated as a later improvement as it s not required by YooChoose to work correctly .