public function getUser() { if ($this->_user === false) { $this->_user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]); } return $this->_user; }
protected function findFreeUsername($username, $n = '') { $exists = User::findOne(['username' => $username . $n]); if ($exists) { $n = $n == '' ? 2 : $n + 1; return $this->findFreeUsername($username, $n); } return $username . $n; }
public function getUser() { return User::findOne(['email' => $this->email]); }
/** * Finds the User model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return User the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if ($this->_model === false) { $this->_model = User::findOne($id); } if ($this->_model !== null) { return $this->_model; } throw new NotFoundHttpException('The requested page does not exist.'); }