protected function findPersonModel($id) { if (($model = Person::findOne(['user_id' => $id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Logs in a user using the provided username and password. * @return boolean whether the user is logged in successfully */ public function login() { if ($this->validate()) { $person = Person::findOne(['user_id' => $this->getUser()->id]); Status::login($person); return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); } return false; }