/**
  * @param TournamentType $type
  * @return TournamentTableInterface
  */
 public function create(TournamentType $type)
 {
     switch ($type) {
         case TournamentType::ROUND_ROBIN():
             return new TournamentTableRoundRobin();
         case TournamentType::SWITZ():
             return new TournamentTableSwitz();
         default:
             throw new TournamentIncorrectTypeException();
     }
 }
 /**
  * @param Tournament $tournament
  * @return TournamentDrawInterface
  * @throws TournamentIncorrectTypeException
  */
 public function create(Tournament $tournament) : TournamentDrawInterface
 {
     switch ($tournament->getTournamentParams()->getType()) {
         case TournamentType::ROUND_ROBIN():
             return $this->container->get("core.service.round_robin");
         case TournamentType::SWITZ():
             return $this->container->get("core.service.swiss");
         default:
             throw new TournamentIncorrectTypeException();
     }
 }
Esempio n. 3
0
 /**
  * @return TournamentType
  */
 public function getType() : TournamentType
 {
     return TournamentType::SWITZ();
 }
Esempio n. 4
0
 /**
  * @param Tournament $tournament
  */
 private function changeTournamentTypeOnSwiss(Tournament $tournament)
 {
     $tournamentParams = TournamentParamsFactory::create(TournamentType::SWITZ())->setTimeBegin($tournament->getTournamentParams()->getTimeBegin());
     $tournament->setTournamentParams($tournamentParams)->setRounds($this->container->getParameter("rounds_for_swiss"));
     $this->getManager()->persist($tournament);
     $this->getManager()->flush();
 }