示例#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();
 }
示例#2
0
 /**
  * Create a new Ground entity
  *
  * @Route("/new_ground")
  * @param Request $request
  * @param Event $event
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function newGroundAction(Request $request, Event $event)
 {
     $ground = new Ground();
     $form = $this->createForm('Abienvenu\\KyjoukanBundle\\Form\\Type\\GroundType', $ground);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $event->addGround($ground);
         $em = $this->getDoctrine()->getManager();
         $em->flush();
         return $this->redirect($this->generateUrl('abienvenu_kyjoukan_event_index', ['slug' => $event->getSlug()]) . "#grounds");
     }
     return $this->render('KyjoukanBundle:Event:new_ground.html.twig', ['event' => $event, 'form' => $form->createView()]);
 }