/** * @param Round $round * @param Team $teamA * @param Team $teamB * @param int[] $scores */ protected function createGames(Round $round, Team $teamA, Team $teamB, array $scores) { foreach ($scores as $score) { $game = new Game(); $game->setRound($round); $game->setTeamA($teamA); $game->setTeamB($teamB); $game->setTeamAScore($score[0]); $game->setTeamBScore($score[1]); $this->getEntityManager()->persist($game); $this->getEntityManager()->flush($game); } }