public function beforeSave($insert) { if ($this->isNewRecord) { $this->user_id = Yii::$app->user->id; if (Settings::getCacheValue('moderateComments', 'comments') == 1) { $this->status = self::STATUS_MODERATE; } else { $this->status = self::STATUS_PUBLIC; } if ($this->show_main == null) { $this->show_main = 1; } } if ($this->date_create == null) { $this->date_create = DateHelper::setFormatDateTime(); } else { $this->date_create = DateHelper::setFormatDateTime($this->date_create); } /*if ($this->scenario === 'delete') { $this->status = self::STATUS_DELETE; }*/ return parent::beforeSave($insert); }