Exemplo n.º 1
0
 /**
  * Methode zum Auslesen eines Spiels.
  *
  * @Route("/game/{slug}", name="bingo_game")
  * @Route("/rest/game/{slug}", name="bingo_game_rest_get", defaults={ "_format" = "json" })
  * @Method("GET")
  * @Rest\View()
  * @param string $slug
  * @return array
  */
 public function getAction($slug)
 {
     $locale = 'de_DE';
     $gamesQuery = new GameQuery();
     $gamesQuery->joinWithI18n($locale);
     $game = $gamesQuery->findOneBySlug($slug);
     return array('name' => 'FreakXoHBingo', 'version' => Kernel::VERSION, 'game' => $game);
 }
Exemplo n.º 2
0
 /**
  * Play the Game Action.
  *
  * @Route("/play/{slug}", name="bingo_play")
  * @param string $slug
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction($slug)
 {
     $locale = 'de_DE';
     $gamesQuery = new GameQuery();
     $gamesQuery->joinWithI18n($locale);
     $game = $gamesQuery->findOneBySlug($slug);
     return $this->render('BingoBundle:Play:play.html.twig', array('name' => 'FreakXoHBingo', 'version' => Kernel::VERSION, 'game' => $game));
 }
Exemplo n.º 3
0
 /**
  * Methode zum Erstellen oder zum Bearbeiten eines Spiels.
  *
  * @Route("/admin/game", name="bingo_game")
  * @Route("/admin/rest/game", name="bingo_game_rest_post", defaults={ "_format" = "json" })
  * @Method("POST")
  * @Rest\View()
  * @param Request $request
  * @return array
  */
 public function postAction(Request $request)
 {
     $locale = 'de_DE';
     if ($request->request->has('locale')) {
         $locale = $request->request->get('locale');
     }
     $id = $request->request->get('id', null);
     $slug = $request->request->get('slug');
     $name = $request->request->get('name');
     if (!is_null($id) || !is_numeric($id)) {
         $gamesQuery = new GameQuery();
         $gamesQuery->joinWithI18n($locale);
         $game = $gamesQuery->findOneById($id);
     }
     if (is_null($game)) {
         $game = new Game();
     }
     $game->setSlug($slug);
     $game->setLocale($locale);
     $game->setName($name);
     $game->save();
     return array('name' => 'FreakXoHBingo', 'version' => Kernel::VERSION, 'status' => true, 'game' => $game);
 }