Command/ExportCommand.php
private function prepare()
    {
        $session = new Session();
        $session->start();

        $request = Request::createFromGlobals();
        $request->setSession($session);

        $this->requestStack->push($request);
        $this->tokenStorage->setToken(
            new AnonymousToken('anonymous', 'anonymous', ['ROLE_ADMINISTRATOR'])
        );
    }
private function prepare()
    {
        $session = new Session();
        $session->start();

        $request = Request::createFromGlobals();
        $request->setSession($session);

        $this->requestStack->push($request);
        $this->tokenStorage->setToken(
            new AnonymousToken('anonymous', 'anonymous', ['ROLE_ADMINISTRATOR'])
        );
    }
private function prepare ( ) { $ session = new Session ( ) ; $ session -> start ( ) ; $ request = Request :: createFromGlobals ( ) ; $ request -> setSession ( $ session ) ; $ this -> requestStack -> push ( $ request ) ; $ this -> tokenStorage -> setToken ( new AnonymousToken ( 'anonymous' , 'anonymous' , [ 'ROLE_ADMINISTRATOR' ] ) ) ; }
Prepares Request and Token for CLI environment, required by RichTextConverter to render embeded content.
Avoid 'The token storage contains no authentication token'
and 'Rendering a fragment can only be done when handling a Request' exceptions.
Prepares Request and Token for CLI environment required by RichTextConverter to render embeded content . Avoid The token storage contains no authentication token and Rendering a fragment can only be done when handling a Request exceptions .