I am trying to set a $form object (from ActiveForm) in session:
$fofArgs = [
'form' => $form,
];
Yii::$app->session->set('fofArgs', $fofArgs);
But When I call in an action:
var_dump(Yii::$app->session->get('fofArgs'));
It prints NULL. My guess is that is related to closures, since I tried to serialize $form and I got an error "Closures can not be serialized".
Any ideas?
This is a question after I thought it was an error with pJax: Yii2. Pjax and Session
UPDATE
Please test doing
Yii::$app->session->set('formtest', $form)
in one controller/action and then
var_dump(Yii::$app->session->get('formtest'));
in a different one, if you do it in the same it seems it works.