/** * Get the User ActiveRecord object attached with application's user * @return XUser */ public function getUserModel($reload = false) { if (!$this->model || $reload) { $this->model = Yii::createComponent($this->userClass); if ($this->id) { $this->model = $this->model->findByPk($this->id); } if (!$this->model) { $this->model = Yii::createComponent($this->userClass); } } return $this->model; }