/** * @inheritdoc */ public function init() { parent::init(); if ($this->scenario == self::SCENARIO_CONFIRM) { $this->active = true; } }
/** * @inheritdoc */ public function init() { parent::init(); if ($this->isNewRecord and $this->scenario == ActiveRecord::SCENARIO_INSERT and !Yii::$app->user->isGuest) { $this->username = Yii::$app->user->identity->username; $this->email = Yii::$app->user->identity->email; } }