Exemplo n.º 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);
 }
Exemplo n.º 2
0
 private function updateDivision(Enrollment $enroll, $division)
 {
     $firstTeam = $enroll->getTeam();
     $firstTeam->setDivision($division);
     $this->em->flush();
 }