S
S
Sergey Beloventsev2017-09-22 14:32:45
Yii
Sergey Beloventsev, 2017-09-22 14:32:45

How to display a message about failed afterSave?

here is the method

public function afterSave($insert, $changedAttributes){
        if ($insert) {
            $parent= $this->parent_id  ? $this->parent : false;
              if($parent &&$parent->childs==false){
                   $parent->childs=true;
                    $parent->save();
               }
        }
}

The question is how can a message be displayed in case of a failed $parent->save(); Preferably fash message.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Greg Popov, 2017-09-22
@Gregpopov

Using the addError method

M
Maxim Timofeev, 2017-09-22
@webinar

ask
display
or demos.krajee.com/widget-details/alert

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question