public function __invoke(Request $request) { $password_hashed = $this->_hasher->hash($request->getPassword()); $player = new Player(); $player->setPassword($request->getPassword()); $player->setUsername($request->getUsername()); $player->setEmail($request->getEmail()); if ($this->_playerRepository->findByUsername($request->getUsername())) { throw new UsernameExistsException(); } if ($this->_playerRepository->findByEmail($request->getEmail())) { throw new EmailExistsException(); } if ($request->getEmail() !== $request->getEmailConfirm()) { throw new EmailConfirmException(); } if ($request->getPassword() !== $request->getPasswordConfirm()) { throw new PasswordConfirmException(); } $player->setPassword($password_hashed); $this->_playerRepository->save($player); return new Response($player); }
public function save(Player $player) { $this->data[$player->getId()] = $player; }
public function createDumpUser(array $data) { foreach ($data as $row) { $player = new Player(); $player->setUsername($row['username']); $player->setId($row['id']); $player->setPassword($row['password']); $player->setEmail($row['email']); $player->setActivationCode($row['activation_code']); $this->playerRepository->save($player); } }