/** * @return mixed */ public function addEmailAction() { $code = $this->params()->fromRoute('code'); $codeEntity = $this->userCodes->getCode4Data($code, UserCodes::TYPE_ADD_EMAIL); if (!$codeEntity) { return $this->forward()->dispatch(AuthController::class, ['action' => 'wrong-code']); } $user = $this->addEmailService->changeMail($codeEntity->getUser()); $this->userCodes->deleteCode($codeEntity); $this->userService->doAuthentication($user); return null; }