Ejemplo n.º 1
0
 /**
  * @param Tournament $tournament
  * @return void
  */
 public function makeDrawForNextRound(Tournament $tournament)
 {
     $nextRound = $tournament->getCurrentRound() + 1;
     $this->makeDraw($tournament, $nextRound);
     $tournament->setCurrentRound($nextRound);
     $this->manager->flush($tournament);
 }
Ejemplo n.º 2
0
 /**
  * @param Tournament $tournament
  * @param User $user
  * @return Game
  * @throws TournamentMissRoundException
  */
 private function getGameForCurrentRound(Tournament $tournament, User $user) : Game
 {
     $tournamentGames = $this->manager->getRepository("CoreBundle:TournamentGame")->findBy(["tournament" => $tournament, "round" => $tournament->getCurrentRound()]);
     foreach ($tournamentGames as $tournamentGame) {
         if ($this->container->get("core.handler.game")->isMyGame($tournamentGame->getGame(), $user)) {
             return $tournamentGame->getGame();
         }
     }
     throw new TournamentMissRoundException();
 }