Пример #1
0
 public function makeCategories(Tournament $tournament)
 {
     $category = new Category();
     $category->setName("F");
     $category->setAge("18");
     $category->setGender("F");
     $category->setClassification("U");
     $category->setMatchtime(60);
     $category->setTopteams(3);
     $category->setTrophys(2);
     $category->setStrategy(0);
     $category->setTournament($tournament);
     $tournament->getCategories()->add($category);
     $this->em->persist($category);
     $category = new Category();
     $category->setName("M");
     $category->setAge("18");
     $category->setGender("M");
     $category->setClassification("U");
     $category->setMatchtime(60);
     $category->setTopteams(0);
     $category->setTrophys(4);
     $category->setStrategy(1);
     $category->setTournament($tournament);
     $tournament->getCategories()->add($category);
     $this->em->persist($category);
     $this->em->flush();
 }
 private function importCategories(Tournament $source_tournament, Tournament $tournament)
 {
     $em = $this->getDoctrine()->getManager();
     $cconversion = array();
     /* @var $category Category */
     foreach ($source_tournament->getCategories() as $category) {
         $new_category = new Category();
         $new_category->setTournament($tournament);
         $new_category->setName($category->getName());
         $new_category->setGender($category->getGender());
         $new_category->setClassification($category->getClassification());
         $new_category->setAge($category->getAge());
         $new_category->setMatchtime($category->getMatchtime());
         $em->persist($new_category);
         $cconversion[$category->getId()] = $new_category;
         foreach ($category->getGroups() as $group) {
             $new_group = new Group();
             $new_group->setCategory($new_category);
             $new_group->setName($group->getName());
             $new_group->setClassification($group->getClassification());
             $em->persist($new_group);
         }
     }
     $em->flush();
     return $cconversion;
 }