guild/backend/modules/status/models/Status.php
2018-10-11 11:15:09 +03:00

22 lines
559 B
PHP

<?php
namespace backend\modules\status\models;
use common\models\UseStatus;
class Status extends \common\models\Status
{
public function afterSave($insert, $changedAttributes)
{
UseStatus::deleteAll(['status_id' => $this->id]);
foreach ($this->use as $item) {
$useStatus = new UseStatus();
$useStatus->status_id = $this->id;
$useStatus->use = $item;
$useStatus->save();
}
parent::afterSave($insert, $changedAttributes); // TODO: Change the autogenerated stub
}
}