hasErrors()) { /** @var \common\models\Customer $user */ $this->getMobileDevice(); } } /** * Finds user by [[username]] * * @return Customer|null|ActiveRecord */ public function getMobileDevice() { if ($this->mobileDevice === null) { $mobileDeviceManager = new MobileDeviceManager(); $this->mobileDevice = $mobileDeviceManager->loginOrCreate($this->cardNumber, $this->deviceIdentifier, $this->deviceName); if ($this->mobileDevice === null) { throw new NotFoundHttpException(); } } return $this->mobileDevice; } }