/** * Finds user by [[username]] * * @return User|null */ protected function getUser() { if ($this->_user === null) { if (\common\components\Utils::isEmail($this->username)) { $this->_user = User::findByEmail($this->username); } else { $this->_user = User::findByUsername($this->username); } } //var_dump($this->_user);//die; return $this->_user; }