I’m discovering Yii2 every day but hit something strange by trying to manage Flash messages I was not seeing them in my session after setting a single flash at the end of my logging as:
$session->setFlash(‘success’, ‘Success’);
So I tried the following in my site controller to check the session:
public function actionIndex()
{
$session = Yii::$app->session;
$session->set(‘language’, ‘fr-FR’);
$session->setFlash(‘Flash01’, ‘01’);
$session->setFlash(‘warning’, ‘Warning’);
$session->setFlash(‘success’, ‘Success’);
$session->setFlash(‘danger’, ‘Danger’);
$session->setFlash(‘info’, ‘Info’);
return $this->render(‘index’);
}
And I discover that I was not seeing in the session the warning,success,danger,info because they were already “consumed” and this without any getFlash or AlertWidget but flash ‘Flash01’ is correctly ready in the session.
Am I missing a point or is it really an oddity…