예제 #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->scenario == self::SCENARIO_CONFIRM) {
         $this->active = true;
     }
 }
예제 #2
0
 /**
  * @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;
     }
 }