Beispiel #1
0
 public function afterSave($insert, $changedAttributes)
 {
     parent::afterSave($insert, $changedAttributes);
     if ($insert) {
         $userProfile = new UserProfile();
         $userProfile->name = $this->username;
         $this->link('userProfile', $userProfile);
     }
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(User::className(), ['id' => 'user_id']);
 }
Beispiel #3
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return \yii\helpers\ArrayHelper::merge(parent::behaviors(), ['timestamp' => ['class' => \yii\behaviors\TimestampBehavior::className()]]);
 }