/** * @Route("/admin/game/edit/{id}", requirements={"id" = "\d+"}, name="admin_game_edit") */ public function editAction(Game $game, Request $request) { $game->setOldName($game->getName()); $form = $this->createForm(new GameType(), $game); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->flush(); $this->notifyPlayersOfGameUpdate($game); return $this->redirectToRoute('admin_game_home'); } return $this->render('admin/game/edit.html.twig', array('game' => $game, 'form' => $form->createView())); }