Answer the question
In order to leave comments, you need to log in
How to automatically load data from model into session in yii2?
Is there a function (magic, probably) (probably, you want something like $model->load($post), only in the opposite direction) that can load all the data from the AR model into the session (or into any variable)? Or just loop over all the attributes?
$ses = Yii::$app->session;
$ses->open();
//И тут вопросы...
$ses->close();
Answer the question
In order to leave comments, you need to log in
There is no such possibility in the standard functionality, but it is easy to implement, for example:
Load data from the model into the session
Save data from session to model
$model->setAttributes(Yii::$app->session->get('model-key', []));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question