Example #1
0
 public function load(ObjectManager $manager)
 {
     // Event
     $event = new Event();
     $event->setName("Exemple de tournoi");
     $manager->persist($event);
     // Teams
     $teams = ["Les incorruptibles", "Boit-sans-soif", "Les intouchables", "Oclomosimanapa", "Chauds les marrons, chaud!", "Nevguen", "Chanteloup Badminton", "C'est sur la ligne", "972", "Pathinacé", "ONSPJ", "La prévière", "Kikonféla", "ZEbet", "Gibon", "Sardines", "Les cressonnettes", "Loulou coptères"];
     foreach ($teams as $teamName) {
         $team = new Team();
         $team->setName($teamName);
         $event->addTeam($team);
     }
     // Grounds
     $grounds = ["A", "B", "C"];
     foreach ($grounds as $groundName) {
         $ground = new Ground();
         $ground->setName($groundName);
         $event->addGround($ground);
     }
     // Phase
     $phase = new Phase();
     $phase->setName("Poules phase 1");
     $phase->setRule(Rule::ROUNDROBIN);
     $phase->setStartDateTime(new \DateTime());
     $phase->setRoundDuration(12 * 60);
     $event->addPhase($phase);
     // Pools
     $colors = [1 => "green", "red", "blue", "darkorange"];
     for ($i = 1; $i <= 4; $i++) {
         $pool = new Pool();
         $pool->setName("Pool {$i}");
         $pool->setColor($colors[$i]);
         $phase->addPool($pool);
     }
     $manager->flush();
 }