public function actionDelete($id) { if ($this->findModel(Profile::className(), $id)->delete() !== false) { $this->setFlash('success', \Yii::t('app', 'Modifications have been saved')); } else { $this->setFlash('error', \Yii::t('app', 'Modifications have not been saved')); } return $this->redirect(['/profile/index']); }
public function getProfile() { return $this->hasOne(Profile::className(), ['user_id' => 'id']); }
public function getCommentOwner() { return $this->hasOne(Profile::className(), ['user_id' => 'user_id']); }
public function getTopProfile() { return $this->hasOne(Profile::className(), ['user_id' => 'psychologist_id']); }
/** * @return \yii\db\ActiveQuery */ public function getProfiles() { return $this->hasMany(Profile::className(), ['region_id' => 'id']); }
public function getProfile() { return $this->hasOne(Profile::className(), ['user_id' => 'user_id'])->setModelScenario(Profile::SCENARIO_LIMITED); }
/** * @return \yii\db\ActiveQuery */ public function getMessageFrom() { return $this->hasOne(Profile::className(), ['user_id' => 'message_from']); }
/** @inheritdoc */ public function afterSave($insert, $changedAttributes) { if ($insert) { $profile = \Yii::createObject(['class' => Profile::className(), 'user_id' => $this->id, 'gravatar_email' => $this->email]); $profile->save(false); } parent::afterSave($insert, $changedAttributes); }
/** * @return \yii\db\ActiveQuery */ public function getProfiles() { return $this->hasMany(\app\models\Profile::className(), ['user_id' => 'id']); }