예제 #1
0
 /**
  * Load teams from Event and copy them into the Phase
  *
  * @param Phase $phase
  * @return int The number of loaded teams
  */
 public function loadTeamsIntoPhase(Phase $phase)
 {
     $loaded = 0;
     foreach ($phase->getEvent()->getTeams() as $team) {
         if (!$phase->hasTeam($team)) {
             $phase->addTeam($team);
             $loaded++;
         }
     }
     $this->em->flush();
     return $loaded;
 }