public function postGameAction(Request $request) { $uuid = $this->uuidGenerator->generate(); $gameStartCommand = new GameStartCommand($uuid, "hup"); $form = $this->formFactory->create(new GameStartType(), $gameStartCommand); $this->handleForm($request, $form, $uuid, $gameStartCommand); }
/** * @param Request $request * @return View|Form */ public function postGameAction(Request $request) { $uuid = $this->uuidGenerator->generate(); // Fake the word $faker = \Faker\Factory::create(); $gameStartCommand = new GameStart($uuid, strtolower($faker->name), new \DateTime("now")); $this->handleCommand($gameStartCommand); $id = $this->getIdOfGame($uuid); $response = ["statusCode" => 0, "id" => $id, "message" => "Game created"]; return new JsonResponse($response, 201, array('Access-Control-Allow-Origin' => '*')); }