public function getUser() { if ($this->_user === false) { $this->_user = User::find(['username' => $this->username])->limit(1)->one(); } return $this->_user; }
protected function findModel($id) { if (($model = User::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }