/** * @param string $identifier * @param string $password * @return void */ public function createAction($identifier, $password) { if ($this->accountRepository->countByAccountIdentifier($identifier) == 1 && $this->userRepository->countByUsername($identifier) == 1) { $this->addFlashMessage('Nickname already taken, please choose another one!'); $this->redirect('new'); } else { $account = $this->accountFactory->createAccountWithPassword($identifier, $password); $this->accountRepository->add($account); $user = new User(); $user->setUsername($identifier); $this->userRepository->add($user); $this->addFlashMessage('Account ' . $identifier . ' successful created! You can login now!'); $this->redirect('index', 'Authentication'); } }