/** * @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); }
/** * @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(); }