L
L
lilwings2020-02-20 22:20:02
Yii
lilwings, 2020-02-20 22:20:02

YII2 how to get old model values?

When editing data, there are two fields that store paths to files. If the user does not change the files, then the data is empty, but they already exist in the model, is it possible to get them? There is no desire to make another request))

5e4edbcab6c65468948586.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-02-20
@lilwings

It won't fit?

public function afterSave($insert, $changedAttributes)
{
        var_dump($changedAttributes['desabilitado']);
        var_dump($this['desabilitado']);
        die;
        [...]
}

Write for what you need to use.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question