/** * Dispatch all the games into the phase, for every pool * * @param Phase $phase */ public function shuffleGames(Phase $phase) { if ($phase->getRule() == Rule::ROUNDROBIN) { $this->dispatchRoundRobinGames($phase); } else { if ($phase->getRule() == Rule::BRACKETS) { $this->dispatchBracketGames($phase); } } // The phase is fully scheduled with playing teams // Now let's find referees for each game $this->findReferees($phase); $this->em->flush(); }