Example #1
0
 private function addTeam(Category $category, Group $group, Club $club, $division, User $user)
 {
     $team = new Team();
     $team->setName($club->getName());
     $team->setColor($category->getName() . $group->getName() . ($group->getGroupOrder()->count() + 1));
     $team->setDivision($division);
     $team->setVacant(false);
     $team->setClub($club);
     $club->getTeams()->add($team);
     $this->em->persist($team);
     $grouporder = new GroupOrder();
     $grouporder->setGroup($group);
     $grouporder->setTeam($team);
     $team->getGroupOrder()->add($grouporder);
     $group->getGroupOrder()->add($grouporder);
     $this->em->persist($grouporder);
     $enrollment = new Enrollment();
     $enrollment->setTeam($team);
     $enrollment->setCategory($category);
     $enrollment->setDate(Date::getDate(new DateTime()));
     $enrollment->setUser($user);
     $team->getEnrollments()->add($enrollment);
     $category->getEnrollments()->add($enrollment);
     $user->getEnrollments()->add($enrollment);
     $this->em->persist($enrollment);
 }
 private function updateList(&$list, $key, $order, Group $group, Team $team)
 {
     if (!array_key_exists($key, $list)) {
         $list[$key] = array('country' => $team->getClub()->getCountry(), 'group' => $group, 'club' => $team->getClub()->getName(), 'first' => array(), 'second' => array(), 'third' => array(), 'forth' => array());
     }
     $list[$key][$order][] = $team;
 }
 public function enrollTeam(Category $category, User $user, Club $club, $name, $division, $vacant = false)
 {
     $team = new Team();
     $team->setClub($club);
     $team->setName($name);
     $team->setColor('');
     $team->setDivision($division);
     $team->setVacant($vacant);
     $this->em->persist($team);
     $this->em->flush();
     $today = new DateTime();
     $enroll = new Enrollment();
     $enroll->setTeam($team);
     $enroll->setCategory($category);
     $enroll->setUser($user);
     $enroll->setDate(Date::getDate($today));
     $this->em->persist($enroll);
     $this->em->flush();
     return $enroll;
 }
Example #4
0
 private function makeKey(Team $team, $date, Timeslot $timeslot)
 {
     return $timeslot->getId() . "-" . $team->getId() . "-" . $date;
 }