Flash session - 1.2.0

Hello,

It seems that using 1.2.0, flashSession is not keept after redirect. Please advice.

    $di['session'] = function() {
        $session = new \Phalcon\Session\Adapter\Files();
        $session->start();
        return $session;
    };

    $di['flashSession'] = function(){
        return new \Phalcon\Flash\Session(array(
                'error' => 'alert alert-error',
                'success' => 'alert alert-success',
                'notice' => 'alert alert-info',
        ));
    };

public function A() { $this->flashSession->success('You did it !'); $this->response->redirect('b'); }

public function B() { print_r($this->flashSession->getMessages()); // Will have no messages }

For me it works ```php $di->set( 'session', function () { $session = new Phalcon\Session\Adapter\Files(); $session->start(); return $session; } );

$di->set( 'flashSession', function () { return new Phalcon\Flash\Session(array( 'error' => 'alert alert-error', 'success' => 'alert alert-success', 'notice' => 'alert alert-info', )); } ); ```

in \views\controllerName\actionName.phtml

<div id="messages"><?php $this->flashSession->output() ?></div>

Calin try to use in your posts ` php your code `



81.1k

Return the response object or disable the view rendering:

public function A()
{
    $this->flashSession->success('You did it !');
    return $this->response->redirect('b');
}
public function A()
{
    $this->flashSession->success('You did it !');
    $this->view->disable();
    $this->response->redirect('b');
}


30.1k

@Phalcon, it is working as you suggested. Thank you.