Ejemplo n.º 1
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'User1Pair1PairTest', 'lastName' => 'User1Pair1PairTest', 'email' => 'User1Pair1PairTest', 'password' => 'password'), array('name' => 'User2Pair1PairTest', 'lastName' => 'User2Pair1PairTest', 'email' => 'User2Pair1PairTest', 'password' => 'password'), array('name' => 'User1Pair2PairTest', 'lastName' => 'User1Pair2PairTest', 'email' => 'User1Pair2PairTest', 'password' => 'password'), array('name' => 'User2Pair2PairTest', 'lastName' => 'User2Pair2PairTest', 'email' => 'User2Pair2PairTest', 'password' => 'password'), array('name' => 'User1Pair3PairTest', 'lastName' => 'User1Pair3PairTest', 'email' => 'User1Pair3PairTest', 'password' => 'password'), array('name' => 'User2Pair3PairTest', 'lastName' => 'User2Pair3PairTest', 'email' => 'User2Pair3PairTest', 'password' => 'password'), array('name' => 'User1Pair4PairTest', 'lastName' => 'User1Pair4PairTest', 'email' => 'User1Pair4PairTest', 'password' => 'password'), array('name' => 'User2Pair4PairTest', 'lastName' => 'User2Pair4PairTest', 'email' => 'User2Pair4PairTest', 'password' => 'password'), array('name' => 'User1Pair5PairTest', 'lastName' => 'User1Pair5PairTest', 'email' => 'User1Pair5PairTest', 'password' => 'password'), array('name' => 'User2Pair5PairTest', 'lastName' => 'User2Pair5PairTest', 'email' => 'User2Pair5PairTest', 'password' => 'password'), array('name' => 'User1Pair6PairTest', 'lastName' => 'User1Pair6PairTest', 'email' => 'User1Pair6PairTest', 'password' => 'password'), array('name' => 'User2Pair6PairTest', 'lastName' => 'User2Pair6PairTest', 'email' => 'User2Pair6PairTest', 'password' => 'password'), array('name' => 'User1Pair7PairTest', 'lastName' => 'User1Pair7PairTest', 'email' => 'User1Pair7PairTest', 'password' => 'password'), array('name' => 'User2Pair7PairTest', 'lastName' => 'User2Pair7PairTest', 'email' => 'User2Pair7PairTest', 'password' => 'password'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1Pair1 = $repository->findOneByName('User1Pair1PairTest');
     $user2Pair1 = $repository->findOneByName('User2Pair1PairTest');
     $user1Pair2 = $repository->findOneByName('User1Pair2PairTest');
     $user2Pair2 = $repository->findOneByName('User2Pair2PairTest');
     $user1Pair3 = $repository->findOneByName('User1Pair3PairTest');
     $user2Pair3 = $repository->findOneByName('User2Pair3PairTest');
     $Pairs = array(array('user1' => $user1Pair1, 'user2' => $user2Pair1), array('user1' => $user1Pair2, 'user2' => $user2Pair2), array('user1' => $user1Pair3, 'user2' => $user2Pair3));
     foreach ($Pairs as $key) {
         $entity = new Pair();
         $entity->setUser1($key['user1']);
         $entity->setUser2($key['user2']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 2
0
 public function load(ObjectManager $manager)
 {
     $notificationDate = new \DateTime();
     $notificationDate->modify('+1 day');
     $admin = new User();
     $admin->setName('UserNotificationTest');
     $admin->setLastName('UserLastName');
     $admin->setEmail('emailNotificationTest');
     $admin->setPassword('password');
     $manager->persist($admin);
     $manager->flush();
     $tournament = new Tournament();
     $tournament->setAdmin($admin);
     $tournament->setName('TournamentNotificationTest');
     $manager->persist($tournament);
     $manager->flush();
     $Notifications = array(array('text' => 'Notification TFG', 'notificationDate' => $notificationDate, 'tournament' => $tournament), array('text' => 'Notification TFG2', 'notificationDate' => $notificationDate, 'tournament' => $tournament), array('text' => 'Notification TFG3', 'notificationDate' => $notificationDate, 'tournament' => $tournament), array('text' => 'Notification TFG4', 'notificationDate' => $notificationDate, 'tournament' => $tournament), array('text' => 'Notification TFG5', 'notificationDate' => $notificationDate, 'tournament' => $tournament), array('text' => 'Notification TFGDELETE', 'notificationDate' => $notificationDate, 'tournament' => $tournament));
     foreach ($Notifications as $key) {
         $entity = new Notification();
         $entity->setText($key['text']);
         $entity->setNotificationDate($key['notificationDate']);
         $entity->setTournament($key['tournament']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 3
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'UserCategoryTest', 'lastName' => 'UserCategoryLastName', 'email' => 'emailCategoryTest', 'password' => 'password'), array('name' => 'User1Pair1CategoryTest', 'lastName' => 'User1Pair1CategoryTest', 'email' => 'User1Pair1CategoryTest', 'password' => 'password'), array('name' => 'User2Pair1CategoryTest', 'lastName' => 'User2Pair1CategoryTest', 'email' => 'User2Pair1CategoryTest', 'password' => 'password'), array('name' => 'User1Pair2CategoryTest', 'lastName' => 'User1Pair2CategoryTest', 'email' => 'User1Pair2CategoryTest', 'password' => 'password'), array('name' => 'User2Pair2CategoryTest', 'lastName' => 'User2Pair2CategoryTest', 'email' => 'User2Pair2CategoryTest', 'password' => 'password'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $manager->persist($entity);
     }
     $manager->flush();
     $tournament = new Tournament();
     $repository = $manager->getRepository('GeneralBundle:User');
     $userAdmin = $repository->findOneByName('UserCategoryTest');
     $tournament->setAdmin($userAdmin);
     $tournament->setName('CategoryTournamentName');
     $manager->persist($tournament);
     $manager->flush();
     $Categories = array(array('name' => 'Category TFG'), array('name' => 'Category TFG2'), array('name' => 'Category TFG3'), array('name' => 'Category TFG4'), array('name' => 'Category TFG5'), array('name' => 'Category TFGDELETE'));
     foreach ($Categories as $key) {
         $entity = new Category();
         $entity->setName($key['name']);
         $manager->persist($entity);
     }
     $manager->flush();
     $Categories = array(array('name' => 'Category Tournament', 'tournament' => $tournament), array('name' => 'Category Tournament1', 'tournament' => $tournament));
     foreach ($Categories as $key) {
         $entity = new Category();
         $entity->setName($key['name']);
         $entity->setTournament($key['tournament']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 4
0
 public function load(ObjectManager $manager)
 {
     $userEntity = new User();
     $userEntity->setName('AnnotationManager');
     $userEntity->setLastName('AnnotationLastName');
     $userEntity->setEmail('AnnotationEmail');
     $userEntity->setPassword('AnnotationPassword');
     $manager->persist($userEntity);
     $manager->flush();
     $Annotations = array(array('text' => 'Annotation TFG', 'user' => $userEntity), array('text' => 'Annotation TFG2', 'user' => $userEntity), array('text' => 'Annotation TFG3'), array('text' => 'Annotation TFG4'), array('text' => 'Annotation TFG5'), array('text' => 'Annotation TFGDELETE'));
     foreach ($Annotations as $key) {
         $entity = new Annotation();
         $entity->setText($key['text']);
         if (!empty($key['user'])) {
             $entity->setUser($key['user']);
         }
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 5
0
 public function load(ObjectManager $manager)
 {
     $admin = new User();
     $admin->setName('UserTournamentTest');
     $admin->setLastName('UserLastName');
     $admin->setEmail('emailTournamentTest');
     $admin->setPassword('password');
     $manager->persist($admin);
     $manager->flush();
     $Tournaments = array(array('admin' => $admin, 'name' => 'Torneo TFG', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''), array('admin' => $admin, 'name' => 'Torneo TFG2', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''), array('admin' => $admin, 'name' => 'Torneo TFG3', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''), array('admin' => $admin, 'name' => 'Torneo TFG4', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''), array('admin' => $admin, 'name' => 'Torneo TFG5', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''), array('admin' => $admin, 'name' => 'Torneo TFGDELETE', 'startInscriptionDate' => new \DateTime(), 'endInscriptionDate' => new \DateTime(), 'startGroupDate' => new \DateTime(), 'endGroupDate' => new \DateTime(), 'startFinalDate' => new \DateTime(), 'endFinalDate' => new \DateTime(), 'registeredLimit' => 10, 'image' => ''));
     foreach ($Tournaments as $key) {
         $entity = new Tournament();
         $entity->setAdmin($key['admin']);
         $entity->setName($key['name']);
         $entity->setStartInscriptionDate($key['startInscriptionDate']);
         $entity->setEndInscriptionDate($key['endInscriptionDate']);
         $entity->setStartGroupDate($key['startGroupDate']);
         $entity->setEndGroupDate($key['endGroupDate']);
         $entity->setStartFinalDate($key['startFinalDate']);
         $entity->setEndFinalDate($key['endFinalDate']);
         $entity->setRegisteredLimit($key['registeredLimit']);
         $entity->setImage($key['image']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Tournament');
     $tournament = $repository->findOneByName('Torneo TFG');
     $Categories = array(array('name' => 'Category Tournament', 'tournament' => $tournament), array('name' => 'Category Tournament1', 'tournament' => $tournament));
     foreach ($Categories as $key) {
         $entity = new Category();
         $entity->setName($key['name']);
         $entity->setTournament($key['tournament']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'alberto', 'lastName' => 'martinez lopez', 'firstPhone' => '626289021', 'email' => '*****@*****.**', 'address' => 'C/ falsa 123', 'city' => 'Villena', 'cp' => '03400', 'password' => 'hola', 'gameLevel' => '10', 'alias' => 'champion'), array('name' => 'rocio', 'lastName' => 'carrasco soriano', 'firstPhone' => '626289021', 'email' => '*****@*****.**', 'address' => 'C/ falsa 123', 'city' => 'Villena', 'cp' => '03400', 'password' => 'hola', 'gameLevel' => '10', 'alias' => 'champion'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setFirstPhone($key['firstPhone']);
         $entity->setEmail($key['email']);
         $entity->setAddress($key['address']);
         $entity->setCity($key['city']);
         $entity->setCP($key['cp']);
         $entity->setPassword($key['password']);
         $entity->setGameLevel($key['gameLevel']);
         $entity->setAlias($key['alias']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1 = $repository->findOneByName('alberto');
     $user2 = $repository->findOneByName('rocio');
     $userPreference = new UserPreference();
     $userPreference->setId($user1->getId());
     $userPreference->setName(true);
     $userPreference->setLastName(true);
     $userPreference->setEmail(true);
     $userPreference->setStatus(true);
     $userPreference->setFirstPhone(true);
     $userPreference->setCity(true);
     $userPreference->setRole(false);
     $userPreference->setSecondPhone(false);
     $userPreference->setAddress(false);
     $userPreference->setCountry(false);
     $userPreference->setCP(false);
     $userPreference->setBirthDate(false);
     $userPreference->setProfileImage(false);
     $userPreference->setGameLevel(false);
     $userPreference->setAlias(false);
     $userPreference->setNotification(false);
     $userPreference->setRegistrationDate(false);
     $userPreference->setGender(false);
     $userPreference1 = new UserPreference();
     $userPreference1->setId($user2->getId());
     $userPreference1->setName(true);
     $userPreference1->setLastName(true);
     $userPreference1->setEmail(true);
     $userPreference1->setStatus(true);
     $userPreference1->setFirstPhone(true);
     $userPreference1->setCity(true);
     $userPreference1->setRole(false);
     $userPreference1->setSecondPhone(false);
     $userPreference1->setAddress(false);
     $userPreference1->setCountry(false);
     $userPreference1->setCP(false);
     $userPreference1->setBirthDate(false);
     $userPreference1->setProfileImage(false);
     $userPreference1->setGameLevel(false);
     $userPreference1->setAlias(false);
     $userPreference1->setNotification(false);
     $userPreference1->setRegistrationDate(false);
     $userPreference1->setGender(false);
     $manager->persist($userPreference);
     $manager->persist($userPreference1);
     $manager->flush();
 }
Ejemplo n.º 7
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'alberto', 'lastName' => 'martinez lopez', 'firstPhone' => '626289021', 'email' => '*****@*****.**', 'address' => 'C/ falsa 123', 'city' => 'Villena', 'cp' => '03400', 'password' => 'hola', 'gameLevel' => '10', 'alias' => 'champion'), array('name' => 'rocio', 'lastName' => 'carrasco soriano', 'firstPhone' => '626289021', 'email' => '*****@*****.**', 'address' => 'C/ falsa 123', 'city' => 'Villena', 'cp' => '03400', 'password' => 'hola', 'gameLevel' => '10', 'alias' => 'champion'), array('name' => 'rocio', 'lastName' => 'carrasco soriano', 'firstPhone' => '626289021', 'email' => '*****@*****.**', 'address' => 'C/ falsa 123', 'city' => 'Villena', 'cp' => '03400', 'password' => 'hola', 'gameLevel' => '10', 'alias' => 'champion'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setFirstPhone($key['firstPhone']);
         $entity->setEmail($key['email']);
         $entity->setAddress($key['address']);
         $entity->setCity($key['city']);
         $entity->setCP($key['cp']);
         $entity->setPassword($key['password']);
         $entity->setGameLevel($key['gameLevel']);
         $entity->setAlias($key['alias']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 8
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'UserInscriptionTest', 'lastName' => 'UserInscriptionTest', 'email' => 'emailInscriptionTest', 'password' => 'password'), array('name' => 'UserInscriptionTest1', 'lastName' => 'UserInscriptionTest1', 'email' => 'emailInscriptionTest1', 'password' => 'password'), array('name' => 'User1Pair1PairTest', 'lastName' => 'User1Pair1PairTest', 'email' => 'User1Pair1PairTest', 'password' => 'password'), array('name' => 'User2Pair1PairTest', 'lastName' => 'User2Pair1PairTest', 'email' => 'User2Pair1PairTest', 'password' => 'password'), array('name' => 'User1Pair2PairTest', 'lastName' => 'User1Pair2PairTest', 'email' => 'User1Pair2PairTest', 'password' => 'password'), array('name' => 'User2Pair2PairTest', 'lastName' => 'User2Pair2PairTest', 'email' => 'User2Pair2PairTest', 'password' => 'password'), array('name' => 'User1Pair3PairTest', 'lastName' => 'User1Pair3PairTest', 'email' => 'User1Pair3PairTest', 'password' => 'password'), array('name' => 'User2Pair3PairTest', 'lastName' => 'User2Pair3PairTest', 'email' => 'User2Pair3PairTest', 'password' => 'password'), array('name' => 'User1Pair4PairTest', 'lastName' => 'User1Pair4PairTest', 'email' => 'User1Pair4PairTest', 'password' => 'password'), array('name' => 'User2Pair4PairTest', 'lastName' => 'User2Pair4PairTest', 'email' => 'User2Pair4PairTest', 'password' => 'password'), array('name' => 'User1Pair5PairTest', 'lastName' => 'User1Pair4PairTest', 'email' => 'User1Pair4PairTest', 'password' => 'password'), array('name' => 'User2Pair5PairTest', 'lastName' => 'User2Pair4PairTest', 'email' => 'User2Pair4PairTest', 'password' => 'password'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $manager->persist($entity);
     }
     $manager->flush();
     $tournament = new Tournament();
     $tournament2 = new Tournament();
     $tournament3 = new Tournament();
     $repository = $manager->getRepository('GeneralBundle:User');
     $userAdmin = $repository->findOneByName('UserInscriptionTest');
     $tournament->setAdmin($userAdmin);
     $tournament->setName('CategoryTournamentName');
     $userAdmin = $repository->findOneByName('UserInscriptionTest1');
     $tournament2->setAdmin($userAdmin);
     $tournament2->setName('CategoryTournamentName1');
     $tournament2->setRegisteredLimit(3);
     $tournament3->setAdmin($userAdmin);
     $tournament3->setName('TournamentToDeleteInscription');
     $manager->persist($tournament);
     $manager->persist($tournament2);
     $manager->persist($tournament3);
     $manager->flush();
     $Categories = array(array('name' => 'Category Tournament', 'registeredLimitMax' => null, 'tournament' => $tournament), array('name' => 'Category Tournament1', 'registeredLimitMax' => 3, 'tournament' => $tournament), array('name' => 'Category Tournament2', 'registeredLimitMax' => null, 'tournament' => $tournament2), array('name' => 'Category Tournament3', 'registeredLimitMax' => null, 'tournament' => $tournament3));
     foreach ($Categories as $key) {
         $entity = new Category();
         $entity->setName($key['name']);
         $entity->setTournament($key['tournament']);
         $entity->setRegisteredLimitMax($key['registeredLimitMax']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Category');
     $category1 = $repository->findOneByName('Category Tournament');
     $category2 = $repository->findOneByName('Category Tournament1');
     $category3 = $repository->findOneByName('Category Tournament2');
     $category4 = $repository->findOneByName('Category Tournament3');
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1Pair1 = $repository->findOneByName('User1Pair1PairTest');
     $user2Pair1 = $repository->findOneByName('User2Pair1PairTest');
     $user1Pair2 = $repository->findOneByName('User1Pair2PairTest');
     $user2Pair2 = $repository->findOneByName('User2Pair2PairTest');
     $user1Pair3 = $repository->findOneByName('User1Pair3PairTest');
     $user2Pair3 = $repository->findOneByName('User2Pair3PairTest');
     $user1Pair4 = $repository->findOneByName('User1Pair4PairTest');
     $user2Pair4 = $repository->findOneByName('User2Pair4PairTest');
     $user1Pair5 = $repository->findOneByName('User1Pair5PairTest');
     $user2Pair5 = $repository->findOneByName('User2Pair5PairTest');
     $Pairs = array(array('user1' => $user1Pair1, 'user2' => $user2Pair1), array('user1' => $user1Pair2, 'user2' => $user2Pair2), array('user1' => $user1Pair3, 'user2' => $user2Pair3), array('user1' => $user1Pair4, 'user2' => $user2Pair4), array('user1' => $user1Pair5, 'user2' => $user2Pair5));
     foreach ($Pairs as $key) {
         $entity = new Pair();
         $entity->setUser1($key['user1']);
         $entity->setUser2($key['user2']);
         $manager->persist($entity);
     }
     $manager->flush();
     $Groups = array(array('name' => 'Group A', 'category' => $category2, 'tournament' => $tournament), array('name' => 'Group B', 'category' => $category2, 'tournament' => $tournament), array('name' => 'Group C', 'category' => $category3, 'tournament' => $tournament2), array('name' => 'Group D', 'category' => $category4, 'tournament' => $tournament3));
     foreach ($Groups as $key) {
         $entity = new GroupCategory();
         $entity->setName($key['name']);
         $entity->setCategory($key['category']);
         $entity->setTournament($key['tournament']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Pair');
     $pair1 = $repository->findOneByUser1($user1Pair1);
     $pair2 = $repository->findOneByUser1($user1Pair2);
     $pair3 = $repository->findOneByUser1($user1Pair3);
     $pair4 = $repository->findOneByUser1($user1Pair4);
     $pair5 = $repository->findOneByUser1($user1Pair5);
     $repository = $manager->getRepository('GeneralBundle:Tournament');
     $tournament = $repository->findOneByName('CategoryTournamentName');
     $tournament1 = $repository->findOneByName('CategoryTournamentName1');
     $tournament2 = $repository->findOneByName('TournamentToDeleteInscription');
     $repository = $manager->getRepository('GeneralBundle:GroupCategory');
     $groupA = $repository->findOneByName('Group A');
     $groupB = $repository->findOneByName('Group B');
     $groupC = $repository->findOneByName('Group C');
     $groupD = $repository->findOneByName('Group D');
     $Inscriptions = array(array('pair' => $pair1, 'tournament' => $tournament, 'category' => $category2, 'group' => $groupA), array('pair' => $pair2, 'tournament' => $tournament, 'category' => $category2, 'group' => $groupB), array('pair' => $pair2, 'tournament' => $tournament1, 'category' => $category3, 'group' => $groupC), array('pair' => $pair3, 'tournament' => $tournament, 'category' => $category2, 'group' => $groupB), array('pair' => $pair4, 'tournament' => $tournament1, 'category' => $category3, 'group' => $groupC), array('pair' => $pair5, 'tournament' => $tournament2, 'category' => $category4, 'group' => $groupD));
     foreach ($Inscriptions as $key) {
         $entity = new Inscription();
         $entity->setPair($key['pair']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setGroup($key['group']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 9
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'UserCategoryTest', 'lastName' => 'UserCategoryLastName', 'email' => 'emailCategoryTest', 'password' => 'password'), array('name' => 'User1Pair1', 'lastName' => 'User1Pair1', 'email' => 'User1Pair1', 'password' => 'pass'), array('name' => 'User2Pair1', 'lastName' => 'User2Pair1', 'email' => 'User2Pair1', 'password' => 'pass'), array('name' => 'User1Pair2', 'lastName' => 'User1Pair2', 'email' => 'User1Pair2', 'password' => 'pass'), array('name' => 'User2Pair2', 'lastName' => 'User2Pair2', 'email' => 'User2Pair2', 'password' => 'pass'), array('name' => 'User1Pair3', 'lastName' => 'User1Pair3', 'email' => 'User1Pair3', 'password' => 'pass'), array('name' => 'User2Pair3', 'lastName' => 'User2Pair3', 'email' => 'User2Pair3', 'password' => 'pass'), array('name' => 'User1Pair4', 'lastName' => 'User1Pair4', 'email' => 'User1Pair4', 'password' => 'pass'), array('name' => 'User2Pair4', 'lastName' => 'User2Pair4', 'email' => 'User2Pair4', 'password' => 'pass'), array('name' => 'User1Pair5', 'lastName' => 'User1Pair5', 'email' => 'User1Pair5', 'password' => 'pass'), array('name' => 'User2Pair5', 'lastName' => 'User2Pair5', 'email' => 'User2Pair5', 'password' => 'pass'), array('name' => 'User1Pair6', 'lastName' => 'User1Pair6', 'email' => 'User1Pair6', 'password' => 'pass'), array('name' => 'User2Pair6', 'lastName' => 'User2Pair6', 'email' => 'User2Pair6', 'password' => 'pass'), array('name' => 'User1Pair7', 'lastName' => 'User1Pair7', 'email' => 'User1Pair7', 'password' => 'pass'), array('name' => 'User2Pair7', 'lastName' => 'User2Pair7', 'email' => 'User2Pair7', 'password' => 'pass'), array('name' => 'User1Pair8', 'lastName' => 'User1Pair8', 'email' => 'User1Pair8', 'password' => 'pass'), array('name' => 'User2Pair8', 'lastName' => 'User2Pair8', 'email' => 'User2Pair8', 'password' => 'pass'), array('name' => 'User1Pair9', 'lastName' => 'User1Pair9', 'email' => 'User1Pair9', 'password' => 'pass'), array('name' => 'User2Pair9', 'lastName' => 'User2Pair9', 'email' => 'User2Pair9', 'password' => 'pass'), array('name' => 'User1Pair10', 'lastName' => 'User1Pair10', 'email' => 'User1Pair10', 'password' => 'pass'), array('name' => 'User2Pair10', 'lastName' => 'User2Pair10', 'email' => 'User2Pair10', 'password' => 'pass'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $userAdmin = $repository->findOneByName('UserCategoryTest');
     $tournament = new Tournament();
     $tournament->setAdmin($userAdmin);
     $tournament->setName('TournamentName');
     $category = new Category();
     $category->setName('Category Test');
     $category->setTournament($tournament);
     $tournament1 = new Tournament();
     $tournament1->setAdmin($userAdmin);
     $tournament1->setName('TournamentName1');
     $category1 = new Category();
     $category1->setName('Category Test1');
     $category1->setTournament($tournament1);
     $manager->persist($category);
     $manager->persist($tournament);
     $manager->persist($category1);
     $manager->persist($tournament1);
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1Pair1 = $repository->findOneByName('User1Pair1');
     $user2Pair1 = $repository->findOneByName('User2Pair1');
     $user1Pair2 = $repository->findOneByName('User1Pair2');
     $user2Pair2 = $repository->findOneByName('User2Pair2');
     $user1Pair3 = $repository->findOneByName('User1Pair3');
     $user2Pair3 = $repository->findOneByName('User2Pair3');
     $user1Pair4 = $repository->findOneByName('User1Pair4');
     $user2Pair4 = $repository->findOneByName('User2Pair4');
     $user1Pair5 = $repository->findOneByName('User1Pair5');
     $user2Pair5 = $repository->findOneByName('User2Pair5');
     $user1Pair6 = $repository->findOneByName('User1Pair6');
     $user2Pair6 = $repository->findOneByName('User2Pair6');
     $user1Pair7 = $repository->findOneByName('User1Pair7');
     $user2Pair7 = $repository->findOneByName('User2Pair7');
     $user1Pair8 = $repository->findOneByName('User1Pair8');
     $user2Pair8 = $repository->findOneByName('User2Pair8');
     $user1Pair9 = $repository->findOneByName('User1Pair9');
     $user2Pair9 = $repository->findOneByName('User2Pair9');
     $user1Pair10 = $repository->findOneByName('User1Pair10');
     $user2Pair10 = $repository->findOneByName('User2Pair10');
     $Pairs = array(array('user1' => $user1Pair1, 'user2' => $user2Pair1), array('user1' => $user1Pair2, 'user2' => $user2Pair2), array('user1' => $user1Pair3, 'user2' => $user2Pair3), array('user1' => $user1Pair4, 'user2' => $user2Pair4), array('user1' => $user1Pair5, 'user2' => $user2Pair5), array('user1' => $user1Pair6, 'user2' => $user2Pair6), array('user1' => $user1Pair7, 'user2' => $user2Pair7), array('user1' => $user1Pair8, 'user2' => $user2Pair8), array('user1' => $user1Pair9, 'user2' => $user2Pair9), array('user1' => $user1Pair10, 'user2' => $user2Pair10));
     foreach ($Pairs as $key) {
         $entity = new Pair();
         $entity->setUser1($key['user1']);
         $entity->setUser2($key['user2']);
         $manager->persist($entity);
     }
     $manager->flush();
     $Groups = array(array('name' => 'Group A Test', 'category' => $category, 'tournament' => $tournament), array('name' => 'Group B Test', 'category' => $category, 'tournament' => $tournament), array('name' => 'Group C Test', 'category' => $category1, 'tournament' => $tournament1));
     foreach ($Groups as $key) {
         $entity = new GroupCategory();
         $entity->setName($key['name']);
         $entity->setCategory($key['category']);
         $entity->setTournament($key['tournament']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Pair');
     $pair1 = $repository->findOneByUser1($user1Pair1);
     $pair2 = $repository->findOneByUser1($user1Pair2);
     $pair3 = $repository->findOneByUser1($user1Pair3);
     $pair4 = $repository->findOneByUser1($user1Pair4);
     $pair5 = $repository->findOneByUser1($user1Pair5);
     $pair6 = $repository->findOneByUser1($user1Pair6);
     $pair7 = $repository->findOneByUser1($user1Pair7);
     $pair8 = $repository->findOneByUser1($user1Pair8);
     $pair9 = $repository->findOneByUser1($user1Pair9);
     $pair10 = $repository->findOneByUser1($user1Pair10);
     $repository = $manager->getRepository('GeneralBundle:GroupCategory');
     $groupA = $repository->findOneByName('Group A Test');
     $groupB = $repository->findOneByName('Group B Test');
     $groupC = $repository->findOneByName('Group C Test');
     $Inscriptions = array(array('pair' => $pair1, 'tournament' => $tournament, 'category' => $category, 'group' => $groupA), array('pair' => $pair2, 'tournament' => $tournament, 'category' => $category, 'group' => $groupA), array('pair' => $pair3, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB), array('pair' => $pair4, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB), array('pair' => $pair5, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB), array('pair' => $pair6, 'tournament' => $tournament1, 'category' => $category1, 'group' => $groupC), array('pair' => $pair7, 'tournament' => $tournament1, 'category' => $category1, 'group' => $groupC), array('pair' => $pair8, 'tournament' => $tournament1, 'category' => $category1, 'group' => $groupC), array('pair' => $pair9, 'tournament' => $tournament1, 'category' => $category1, 'group' => $groupC), array('pair' => $pair10, 'tournament' => $tournament1, 'category' => $category1, 'group' => $groupC));
     foreach ($Inscriptions as $key) {
         $entity = new Inscription();
         $entity->setPair($key['pair']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setGroup($key['group']);
         $manager->persist($entity);
     }
     $manager->flush();
     $Games = array(array('pair1' => $pair1, 'pair2' => $pair2, 'tournament' => $tournament, 'category' => $category, 'group' => $groupA, 'description' => 'Game Test 1', 'score' => '6/0 - 6/0'), array('pair1' => $pair3, 'pair2' => $pair4, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB, 'description' => 'Game Test 2', 'score' => '6/3 - 6/3'), array('pair1' => $pair4, 'pair2' => $pair5, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB, 'description' => 'Game Test 3', 'score' => '7/5 - 6/2'), array('pair1' => $pair5, 'pair2' => $pair3, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB, 'description' => 'Game Test 4', 'score' => '6/3 - 3/6 - 7/5'), array('pair1' => null, 'pair2' => null, 'tournament' => $tournament, 'category' => $category, 'group' => $groupB, 'description' => 'Game DELETED', 'score' => '6/3 - 3/6 - 7/5'));
     foreach ($Games as $key) {
         $entity = new Game();
         $entity->setPair1($key['pair1']);
         $entity->setPair2($key['pair2']);
         $entity->setDescription($key['description']);
         $entity->setScore($key['score']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setGroup($key['group']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 10
0
 public function load(ObjectManager $manager)
 {
     $repository = $manager->getRepository('GeneralBundle:UserRole');
     $playerRole = $repository->findOneByValue('Player');
     $tournamentAdminRole = $repository->findOneByValue('TournamentAdmin');
     $repository = $manager->getRepository('GeneralBundle:UserStatus');
     $userStatus = $repository->findOneByValue('Registered');
     $Users = array(array('name' => 'Natalia', 'lastName' => 'Perez', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Servando', 'lastName' => 'Escobar', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Victoria', 'lastName' => 'Abril', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Alberto', 'lastName' => 'Martinez', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Cecilia', 'lastName' => 'Soriano', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Saray', 'lastName' => 'Lozano', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Ana', 'lastName' => 'Guardiola', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Andrea', 'lastName' => 'Garcia', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Rocio', 'lastName' => 'Lopez', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Francisco', 'lastName' => 'Garcia', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Juan', 'lastName' => 'Martinez', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Macarena', 'lastName' => 'Villalon', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Rodrigo', 'lastName' => 'Eduarte', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Lorenzo', 'lastName' => 'Pascual', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Maria', 'lastName' => 'Gomez', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Angel', 'lastName' => 'Llacer', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Monica', 'lastName' => 'Naranjo', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Nerea', 'lastName' => 'Tomas', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Risto', 'lastName' => 'Mejide', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Jose', 'lastName' => 'Garcia', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Carlos', 'lastName' => 'Latre', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Silvia', 'lastName' => 'Abril', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Female'), array('name' => 'Santiago', 'lastName' => 'Segura', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'), array('name' => 'Mario', 'lastName' => 'Vaquerizo', 'email' => '*****@*****.**', 'password' => 'password', 'gender' => 'Male'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $entity->setGender($key['gender']);
         $entity->setStatus($userStatus);
         if ($key['name'] == 'Alberto') {
             $entity->addRole($tournamentAdminRole);
             $entity->addRole($playerRole);
         } else {
             $entity->addRole($playerRole);
         }
         $manager->persist($entity);
         $manager->flush();
         $entityPreference = new UserPreference();
         $entityPreference->setId($entity->getId());
         $entityPreference->setName(true);
         $entityPreference->setLastName(true);
         $entityPreference->setEmail(true);
         $entityPreference->setStatus(true);
         $entityPreference->setFirstPhone(true);
         $entityPreference->setCity(true);
         $entityPreference->setSecondPhone(false);
         $entityPreference->setRole(false);
         $entityPreference->setAddress(false);
         $entityPreference->setCountry(false);
         $entityPreference->setCP(false);
         $entityPreference->setBirthDate(false);
         $entityPreference->setProfileImage(false);
         $entityPreference->setGameLevel(false);
         $entityPreference->setAlias(false);
         $entityPreference->setNotification(false);
         $entityPreference->setRegistrationDate(false);
         $entityPreference->setGender(false);
         $manager->persist($entityPreference);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $userAdmin = $repository->findOneByName('Alberto');
     $repository = $manager->getRepository('GeneralBundle:TournamentStatus');
     $tournamentStatusCreated = $repository->findOneByValue('Created');
     $tournamentStatusMatchs = $repository->findOneByValue('Group phase (Matchs done)');
     $Tournaments = array(array('name' => 'Torneo Zoombie', 'admin' => $userAdmin, 'regLimit' => 50, 'startIns' => new \DateTime('2016-06-01'), 'endIns' => new \DateTime('2016-06-07'), 'startGroup' => new \DateTime('2016-06-09'), 'endGroup' => new \DateTime('2016-06-15'), 'startFinal' => new \DateTime('2016-06-16'), 'endFinal' => new \DateTime('2016-06-20'), 'status' => $tournamentStatusMatchs), array('name' => 'Torneo UA', 'admin' => $userAdmin, 'regLimit' => 4, 'startIns' => new \DateTime('2016-06-01'), 'endIns' => new \DateTime('2016-06-07'), 'startGroup' => new \DateTime('2016-06-09'), 'endGroup' => new \DateTime('2016-06-15'), 'startFinal' => new \DateTime('2016-06-16'), 'endFinal' => new \DateTime('2016-06-20'), 'status' => $tournamentStatusCreated));
     foreach ($Tournaments as $key) {
         $entity = new Tournament();
         $entity->setName($key['name']);
         $entity->setAdmin($key['admin']);
         $entity->setRegisteredLimit($key['regLimit']);
         $entity->setStartInscriptionDate($key['startIns']);
         $entity->setEndInscriptionDate($key['endIns']);
         $entity->setStartGroupDate($key['startGroup']);
         $entity->setEndGroupDate($key['endGroup']);
         $entity->setStartFinalDate($key['startFinal']);
         $entity->setEndFinalDate($key['endFinal']);
         $entity->setStatus($key['status']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Tournament');
     $tournament1 = $repository->findOneByName('Torneo Zoombie');
     $tournament2 = $repository->findOneByName('Torneo UA');
     $Categories = array(array('name' => 'Category Femenina', 'gender' => 'Female', 'tournament' => $tournament1, 'bgColor' => '#1d1363'), array('name' => 'Category Masculina', 'gender' => 'Male', 'tournament' => $tournament1, 'bgColor' => '#BFFF00'), array('name' => 'Category Mixta', 'gender' => 'Mixed', 'tournament' => $tournament2, 'bgColor' => '#1d1363'));
     foreach ($Categories as $key) {
         $entity = new Category();
         $entity->setName($key['name']);
         $entity->setGender($key['gender']);
         $entity->setTournament($key['tournament']);
         $entity->setBgColor($key['bgColor']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Category');
     $category1 = $repository->findOneByName('Category Femenina');
     $category2 = $repository->findOneByName('Category Masculina');
     $category3 = $repository->findOneByName('Category Mixta');
     $Groups = array(array('name' => 'Group 1F', 'category' => $category1, 'tournament' => $tournament1, 'numPairs' => 3), array('name' => 'Group 1M', 'category' => $category2, 'tournament' => $tournament1, 'numPairs' => 4), array('name' => 'Group 2M', 'category' => $category2, 'tournament' => $tournament1, 'numPairs' => 4), array('name' => 'Group 3M', 'category' => $category2, 'tournament' => $tournament1, 'numPairs' => 4));
     foreach ($Groups as $key) {
         $entity = new GroupCategory();
         $entity->setName($key['name']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setNumPairs($key['numPairs']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:GroupCategory');
     $group1F = $repository->findOneByName('Group 1F');
     $group1M = $repository->findOneByName('Group 1M');
     $group2M = $repository->findOneByName('Group 2M');
     $group3M = $repository->findOneByName('Group 3M');
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1Pair1 = $repository->findOneByName('Natalia');
     $user2Pair1 = $repository->findOneByName('Victoria');
     $user1Pair2 = $repository->findOneByName('Alberto');
     $user2Pair2 = $repository->findOneByName('Cecilia');
     $user1Pair3 = $repository->findOneByName('Saray');
     $user2Pair3 = $repository->findOneByName('Ana');
     $user1Pair4 = $repository->findOneByName('Andrea');
     $user2Pair4 = $repository->findOneByName('Rocio');
     $user1Pair5 = $repository->findOneByName('Francisco');
     $user2Pair5 = $repository->findOneByName('Juan');
     $user1Pair6 = $repository->findOneByName('Macarena');
     $user2Pair6 = $repository->findOneByName('Rodrigo');
     $user1Pair7 = $repository->findOneByName('Lorenzo');
     $user2Pair7 = $repository->findOneByName('Maria');
     $user1Pair8 = $repository->findOneByName('Angel');
     $user2Pair8 = $repository->findOneByName('Monica');
     $user1Pair9 = $repository->findOneByName('Nerea');
     $user2Pair9 = $repository->findOneByName('Risto');
     $user1Pair10 = $repository->findOneByName('Jose');
     $user2Pair10 = $repository->findOneByName('Carlos');
     $user1Pair11 = $repository->findOneByName('Silvia');
     $user2Pair11 = $repository->findOneByName('Santiago');
     $user1Pair12 = $repository->findOneByName('Mario');
     $user2Pair12 = $repository->findOneByName('Servando');
     $Pairs = array(array('user1' => $user1Pair1, 'user2' => $user2Pair1, 'gender' => 'Female'), array('user1' => $user1Pair2, 'user2' => $user2Pair2, 'gender' => 'Mixed'), array('user1' => $user1Pair3, 'user2' => $user2Pair3, 'gender' => 'Female'), array('user1' => $user1Pair4, 'user2' => $user2Pair4, 'gender' => 'Female'), array('user1' => $user1Pair5, 'user2' => $user2Pair5, 'gender' => 'Male'), array('user1' => $user1Pair6, 'user2' => $user2Pair6, 'gender' => 'Mixed'), array('user1' => $user1Pair7, 'user2' => $user2Pair7, 'gender' => 'Mixed'), array('user1' => $user1Pair8, 'user2' => $user2Pair8, 'gender' => 'Mixed'), array('user1' => $user1Pair9, 'user2' => $user2Pair9, 'gender' => 'Mixed'), array('user1' => $user1Pair10, 'user2' => $user2Pair10, 'gender' => 'Male'), array('user1' => $user1Pair11, 'user2' => $user2Pair11, 'gender' => 'Mixed'), array('user1' => $user1Pair12, 'user2' => $user2Pair12, 'gender' => 'Male'));
     foreach ($Pairs as $key) {
         $entity = new Pair();
         $entity->setUser1($key['user1']);
         $entity->setUser2($key['user2']);
         $entity->setGender($key['gender']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Pair');
     $pair1 = $repository->findOneByUser1($user1Pair1);
     $pair2 = $repository->findOneByUser1($user1Pair2);
     $pair3 = $repository->findOneByUser1($user1Pair3);
     $pair4 = $repository->findOneByUser1($user1Pair4);
     $pair5 = $repository->findOneByUser1($user1Pair5);
     $pair6 = $repository->findOneByUser1($user1Pair6);
     $pair7 = $repository->findOneByUser1($user1Pair7);
     $pair8 = $repository->findOneByUser1($user1Pair8);
     $pair9 = $repository->findOneByUser1($user1Pair9);
     $pair10 = $repository->findOneByUser1($user1Pair10);
     $pair11 = $repository->findOneByUser1($user1Pair11);
     $pair12 = $repository->findOneByUser1($user1Pair12);
     $repository = $manager->getRepository('GeneralBundle:InscriptionStatus');
     $inscriptionStatusNotClassified = $repository->findOneByValue('Not Classified');
     $Inscriptions = array(array('pair' => $pair1, 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F), array('pair' => $pair3, 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F), array('pair' => $pair4, 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F), array('pair' => $pair1, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M), array('pair' => $pair2, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M), array('pair' => $pair3, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M), array('pair' => $pair4, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M), array('pair' => $pair5, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M), array('pair' => $pair6, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M), array('pair' => $pair7, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M), array('pair' => $pair8, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M), array('pair' => $pair9, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M), array('pair' => $pair10, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M), array('pair' => $pair11, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M), array('pair' => $pair12, 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M));
     foreach ($Inscriptions as $key) {
         $entity = new Inscription();
         $entity->setPair($key['pair']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setGroup($key['group']);
         $entity->setHasObservations(false);
         $entity->setStatus($inscriptionStatusNotClassified);
         $manager->persist($entity);
     }
     $manager->flush();
     $schedule = new Schedule();
     $schedule->setStartDate('2016-06-10');
     $schedule->setMaxRange('11:00:00');
     $schedule->setMinRange('09:00:00');
     $schedule->setTournament($tournament1);
     $manager->persist($schedule);
     $manager->flush();
     $tournament1->setSchedule($schedule);
     $manager->persist($tournament1);
     $manager->flush();
     $Tracks = array(array('title' => 'Track 1', 'schedule' => $schedule), array('title' => 'Track 2', 'schedule' => $schedule), array('title' => 'Track 3', 'schedule' => $schedule), array('title' => 'Track 4', 'schedule' => $schedule));
     foreach ($Tracks as $key) {
         $entity = new ScheduleTrack();
         $entity->setTitle($key['title']);
         $entity->setSchedule($key['schedule']);
         $manager->persist($entity);
     }
     $manager->flush();
     $scheduleRangeDate = new ScheduleRangeDate();
     $scheduleRangeDate->setSchedule($schedule);
     $manager->persist($scheduleRangeDate);
     $manager->flush();
     $ScheduleDate = array(array('date' => new \DateTime('2016-06-10 00:00:00'), 'scheduleRangeDate' => $scheduleRangeDate), array('date' => new \DateTime('2016-06-11 00:00:00'), 'scheduleRangeDate' => $scheduleRangeDate), array('date' => new \DateTime('2016-06-12 00:00:00'), 'scheduleRangeDate' => $scheduleRangeDate));
     foreach ($ScheduleDate as $key) {
         $entity = new ScheduleDate();
         $entity->setScheduleRangeDate($key['scheduleRangeDate']);
         $entity->setDate($key['date']);
         $manager->persist($entity);
     }
     $manager->flush();
     $ScheduleRange = array(array('fromHour' => 'T09:00:00', 'toHour' => 'T10:00:00', 'scheduleRangeDate' => $scheduleRangeDate), array('fromHour' => 'T10:00:00', 'toHour' => 'T11:00:00', 'scheduleRangeDate' => $scheduleRangeDate));
     foreach ($ScheduleRange as $key) {
         $entity = new ScheduleRange();
         $entity->setScheduleRangeDate($key['scheduleRangeDate']);
         $entity->setToHour($key['toHour']);
         $entity->setFromHour($key['fromHour']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:ScheduleTrack');
     $track1 = $repository->findOneByTitle('Track 1');
     $track2 = $repository->findOneByTitle('Track 2');
     $track3 = $repository->findOneByTitle('Track 3');
     $track4 = $repository->findOneByTitle('Track 4');
     $schedule->setScheduleJson('[{"id":"1","start":"2016-06-10T09:00:00","end":"2016-06-10T10:00:00","resourceId":' . $track1->getId() . ',"title":"Natalia-Victoria\\nSaray-Ana","backgroundColor":"#1d1363"},{"id":"2","start":"2016-06-10T09:00:00","end":"2016-06-10T10:00:00","resourceId":' . $track2->getId() . ',"title":"Natalia-Victoria\\nAndrea-Rocio","backgroundColor":"#1d1363"},{"id":"3","start":"2016-06-10T09:00:00","end":"2016-06-10T10:00:00","resourceId":' . $track3->getId() . ',"title":"Saray-Ana\\nAndrea-Rocio","backgroundColor":"#1d1363"},{"id":"4","start":"2016-06-10T09:00:00","end":"2016-06-10T10:00:00","resourceId":' . $track4->getId() . ',"title":"Natalia-Victoria\\nAlberto-Cecilia","backgroundColor":"#BFFF00"},{"id":"5","start":"2016-06-10T10:00:00","end":"2016-06-10T11:00:00","resourceId":' . $track1->getId() . ',"title":"Natalia-Victoria\\nSaray-Ana","backgroundColor":"#BFFF00"},{"id":"6","start":"2016-06-10T10:00:00","end":"2016-06-10T11:00:00","resourceId":' . $track2->getId() . ',"title":"Natalia-Victoria\\nJose-Carlos","backgroundColor":"#BFFF00"},{"id":"7","start":"2016-06-10T10:00:00","end":"2016-06-10T11:00:00","resourceId":' . $track3->getId() . ',"title":"Alberto-Cecilia\\nSaray-Ana","backgroundColor":"#BFFF00"},{"id":"8","start":"2016-06-10T10:00:00","end":"2016-06-10T11:00:00","resourceId":' . $track4->getId() . ',"title":"Alberto-Cecilia\\nJose-Carlos","backgroundColor":"#BFFF00"},{"id":"9","start":"2016-06-11T09:00:00","end":"2016-06-11T10:00:00","resourceId":' . $track1->getId() . ',"title":"Saray-Ana\\nJose-Carlos","backgroundColor":"#BFFF00"},{"id":"10","start":"2016-06-11T09:00:00","end":"2016-06-11T10:00:00","resourceId":' . $track2->getId() . ',"title":"Andrea-Rocio\\nFrancisco-Juan","backgroundColor":"#BFFF00"},{"id":"11","start":"2016-06-11T09:00:00","end":"2016-06-11T10:00:00","resourceId":' . $track3->getId() . ',"title":"Andrea-Rocio\\nMacarena-Rodrigo","backgroundColor":"#BFFF00"},{"id":"12","start":"2016-06-11T09:00:00","end":"2016-06-11T10:00:00","resourceId":' . $track4->getId() . ',"title":"Andrea-Rocio\\nSilvia-Santiago","backgroundColor":"#BFFF00"},{"id":"13","start":"2016-06-11T10:00:00","end":"2016-06-11T11:00:00","resourceId":' . $track1->getId() . ',"title":"Francisco-Juan\\nMacarena-Rodrigo","backgroundColor":"#BFFF00"},{"id":"14","start":"2016-06-11T10:00:00","end":"2016-06-11T11:00:00","resourceId":' . $track2->getId() . ',"title":"Francisco-Juan\\nSilvia-Santiago","backgroundColor":"#BFFF00"},{"id":"15","start":"2016-06-11T10:00:00","end":"2016-06-11T11:00:00","resourceId":' . $track3->getId() . ',"title":"Macarena-Rodrigo\\nSilvia-Santiago","backgroundColor":"#BFFF00"},{"id":"16","start":"2016-06-11T10:00:00","end":"2016-06-11T11:00:00","resourceId":' . $track4->getId() . ',"title":"Lorenzo-Maria\\nAngel-Monica","backgroundColor":"#BFFF00"},{"id":"17","start":"2016-06-12T09:00:00","end":"2016-06-12T10:00:00","resourceId":' . $track1->getId() . ',"title":"Lorenzo-Maria\\nNerea-Risto","backgroundColor":"#BFFF00"},{"id":"18","start":"2016-06-12T09:00:00","end":"2016-06-12T10:00:00","resourceId":' . $track2->getId() . ',"title":"Lorenzo-Maria\\nMario-Servando","backgroundColor":"#BFFF00"},{"id":"19","start":"2016-06-12T09:00:00","end":"2016-06-12T10:00:00","resourceId":' . $track3->getId() . ',"title":"Angel-Monica\\nNerea-Risto","backgroundColor":"#BFFF00"},{"id":"20","start":"2016-06-12T09:00:00","end":"2016-06-12T10:00:00","resourceId":' . $track4->getId() . ',"title":"Angel-Monica\\nMario-Servando","backgroundColor":"#BFFF00"},{"id":"21","start":"2016-06-12T10:00:00","end":"2016-06-12T11:00:00","resourceId":' . $track1->getId() . ',"title":"Nerea-Risto\\nMario-Servando","backgroundColor":"#BFFF00"},{"id":"22","start":"2016-06-12T10:00:00","end":"2016-06-12T11:00:00","resourceId":' . $track2->getId() . ',"title":"Not Set","backgroundColor":"Not Set"},{"id":"23","start":"2016-06-12T10:00:00","end":"2016-06-12T11:00:00","resourceId":' . $track3->getId() . ',"title":"Not Set","backgroundColor":"Not Set"},{"id":"24","start":"2016-06-12T10:00:00","end":"2016-06-12T11:00:00","resourceId":' . $track4->getId() . ',"title":"Not Set","backgroundColor":"Not Set"}]');
     $schedule->setScheduleResourcesJson('[{"id":' . $track1->getId() . ',"title":"Track 1"},{"id":' . $track2->getId() . ',"title":"Track 2"},{"id":' . $track3->getId() . ',"title":"Track 3"},{"id":' . $track4->getId() . ',"title":"Track 4"}]');
     $manager->persist($schedule);
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:GameStatus');
     $gameStatus = $repository->findOneByValue('Created');
     $Games = array(array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair1, 'pair2' => $pair3, 'numOfScheduleRange' => 1, 'bgColor' => $category1->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair1, 'pair2' => $pair4, 'numOfScheduleRange' => 2, 'bgColor' => $category1->getBgColor(), 'score' => '3/6 2/6', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category1, 'group' => $group1F, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair3, 'pair2' => $pair4, 'numOfScheduleRange' => 3, 'bgColor' => $category1->getBgColor(), 'score' => '6/1 4/6 6/1', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair1, 'pair2' => $pair2, 'numOfScheduleRange' => 4, 'bgColor' => $category2->getBgColor(), 'score' => '0/6 0/6', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair1, 'pair2' => $pair3, 'numOfScheduleRange' => 5, 'bgColor' => $category2->getBgColor(), 'score' => '4/6 1/6', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair1, 'pair2' => $pair4, 'numOfScheduleRange' => 6, 'bgColor' => $category2->getBgColor(), 'score' => '6/3 6/2', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair2, 'pair2' => $pair3, 'numOfScheduleRange' => 7, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 1/6 6/4', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-10T09:00:00', 'endDate' => '2016-06-10T10:00:00', 'pair1' => $pair2, 'pair2' => $pair4, 'numOfScheduleRange' => 8, 'bgColor' => $category2->getBgColor(), 'score' => '3/6 7/5 1/6', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group1M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair3, 'pair2' => $pair4, 'numOfScheduleRange' => 9, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair5, 'pair2' => $pair6, 'numOfScheduleRange' => 10, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair5, 'pair2' => $pair7, 'numOfScheduleRange' => 11, 'bgColor' => $category2->getBgColor(), 'score' => '6/1 2/6 6/1', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair5, 'pair2' => $pair8, 'numOfScheduleRange' => 12, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair6, 'pair2' => $pair7, 'numOfScheduleRange' => 13, 'bgColor' => $category2->getBgColor(), 'score' => '6/1 6/2', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair6, 'pair2' => $pair8, 'numOfScheduleRange' => 14, 'bgColor' => $category2->getBgColor(), 'score' => '2/6 7/5 5/7', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group2M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair7, 'pair2' => $pair8, 'numOfScheduleRange' => 15, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-11T09:00:00', 'endDate' => '2016-06-11T10:00:00', 'pair1' => $pair9, 'pair2' => $pair10, 'numOfScheduleRange' => 16, 'bgColor' => $category2->getBgColor(), 'score' => '6/7 6/7', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-12T09:00:00', 'endDate' => '2016-06-12T10:00:00', 'pair1' => $pair9, 'pair2' => $pair11, 'numOfScheduleRange' => 17, 'bgColor' => $category2->getBgColor(), 'score' => '1/6 7/6 5/7', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-12T09:00:00', 'endDate' => '2016-06-12T10:00:00', 'pair1' => $pair9, 'pair2' => $pair12, 'numOfScheduleRange' => 18, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-12T09:00:00', 'endDate' => '2016-06-12T10:00:00', 'pair1' => $pair10, 'pair2' => $pair11, 'numOfScheduleRange' => 19, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-12T09:00:00', 'endDate' => '2016-06-12T10:00:00', 'pair1' => $pair10, 'pair2' => $pair12, 'numOfScheduleRange' => 20, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false), array('description' => 'torneo zoombie', 'tournament' => $tournament1, 'category' => $category2, 'group' => $group3M, 'startDate' => '2016-06-12T09:00:00', 'endDate' => '2016-06-12T10:00:00', 'pair1' => $pair11, 'pair2' => $pair12, 'numOfScheduleRange' => 21, 'bgColor' => $category2->getBgColor(), 'score' => '6/4 7/5', 'isDrawGame' => false));
     foreach ($Games as $key) {
         $entity = new Game();
         $entity->setDescription($key['description']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $entity->setGroup($key['group']);
         $entity->setStartDate($key['startDate']);
         $entity->setEndDate($key['endDate']);
         $entity->setPair1($key['pair1']);
         $entity->setPair2($key['pair2']);
         $entity->setScheduleId($key['numOfScheduleRange']);
         $entity->setScore($key['score']);
         $entity->setBgColor($key['bgColor']);
         $entity->setStatus($gameStatus);
         $entity->setIsDrawGame($key['isDrawGame']);
         $manager->persist($entity);
     }
     $manager->flush();
 }
Ejemplo n.º 11
0
 public function addUser(User $user)
 {
     $user->addNotification($this);
     $this->user[] = $user;
 }
Ejemplo n.º 12
0
 public function load(ObjectManager $manager)
 {
     $Users = array(array('name' => 'UserObservationTest', 'lastName' => 'UserObservationTest', 'email' => 'emailObservationTest', 'password' => 'password'), array('name' => 'User1Pair1ObservationTest', 'lastName' => 'User1Pair1ObservationTest', 'email' => 'User1Pair1ObservationTest', 'password' => 'password'), array('name' => 'User2Pair1ObservationTest', 'lastName' => 'User2Pair1ObservationTest', 'email' => 'User2Pair1ObservationTest', 'password' => 'password'), array('name' => 'User1Pair2ObservationTest', 'lastName' => 'User1Pair2ObservationTest', 'email' => 'User1Pair2ObservationTest', 'password' => 'password'), array('name' => 'User2Pair2ObservationTest', 'lastName' => 'User2Pair2ObservationTest', 'email' => 'User2Pair2ObservationTest', 'password' => 'password'), array('name' => 'User1Pair3ObservationTest', 'lastName' => 'User1Pair3ObservationTest', 'email' => 'User1Pair3ObservationTest', 'password' => 'password'), array('name' => 'User2Pair3ObservationTest', 'lastName' => 'User2Pair3ObservationTest', 'email' => 'User2Pair3ObservationTest', 'password' => 'password'));
     foreach ($Users as $key) {
         $entity = new User();
         $entity->setName($key['name']);
         $entity->setLastName($key['lastName']);
         $entity->setEmail($key['email']);
         $entity->setPassword($key['password']);
         $manager->persist($entity);
     }
     $manager->flush();
     $tournament = new Tournament();
     $repository = $manager->getRepository('GeneralBundle:User');
     $userAdmin = $repository->findOneByName('UserObservationTest');
     $tournament->setAdmin($userAdmin);
     $tournament->setName('ObservationTournamentName');
     $manager->persist($tournament);
     $manager->flush();
     $category = new Category();
     $category->setName('Category Observation');
     $category->setTournament($tournament);
     $manager->persist($category);
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:User');
     $user1Pair1 = $repository->findOneByName('User1Pair1ObservationTest');
     $user2Pair1 = $repository->findOneByName('User2Pair1ObservationTest');
     $user1Pair2 = $repository->findOneByName('User1Pair2ObservationTest');
     $user2Pair2 = $repository->findOneByName('User2Pair2ObservationTest');
     $user1Pair3 = $repository->findOneByName('User1Pair3ObservationTest');
     $user2Pair3 = $repository->findOneByName('User2Pair3ObservationTest');
     $Pairs = array(array('user1' => $user1Pair1, 'user2' => $user2Pair1), array('user1' => $user1Pair2, 'user2' => $user2Pair2), array('user1' => $user1Pair3, 'user2' => $user2Pair3));
     foreach ($Pairs as $key) {
         $entity = new Pair();
         $entity->setUser1($key['user1']);
         $entity->setUser2($key['user2']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Pair');
     $pair1 = $repository->findOneByUser1($user1Pair1);
     $pair2 = $repository->findOneByUser1($user1Pair2);
     $pair3 = $repository->findOneByUser1($user1Pair3);
     $Inscriptions = array(array('pair' => $pair1, 'tournament' => $tournament, 'category' => $category), array('pair' => $pair2, 'tournament' => $tournament, 'category' => $category), array('pair' => $pair3, 'tournament' => $tournament, 'category' => $category));
     foreach ($Inscriptions as $key) {
         $entity = new Inscription();
         $entity->setPair($key['pair']);
         $entity->setTournament($key['tournament']);
         $entity->setCategory($key['category']);
         $manager->persist($entity);
     }
     $manager->flush();
     $repository = $manager->getRepository('GeneralBundle:Inscription');
     $inscription1 = $repository->findOneByPair($pair1);
     $inscription2 = $repository->findOneByPair($pair2);
     $inscription3 = $repository->findOneByPair($pair3);
     $Observations = array(array('date' => new \DateTime(), 'fromHour' => 10, 'toHour' => 14, 'inscription' => $inscription1), array('date' => new \DateTime(), 'fromHour' => 16, 'toHour' => 18, 'inscription' => $inscription2), array('date' => new \DateTime(), 'fromHour' => 16, 'toHour' => 18, 'inscription' => $inscription3));
     foreach ($Observations as $key) {
         $entity = new Observation();
         $entity->setDate($key['date']);
         $entity->setFromHour($key['fromHour']);
         $entity->setToHour($key['toHour']);
         $entity->setInscription($key['inscription']);
         $manager->persist($entity);
     }
     $manager->flush();
 }