public function __toString() { return $this->classification . ":" . ($this->group ? $this->group->getName() : $this->litra) . $this->branch . "#" . $this->rank; }
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 checkForm($form, Group $group) { if ($form->isValid()) { if ($group->getName() == null || trim($group->getName()) == '') { $form->addError(new FormError($this->get('translator')->trans('FORM.GROUP.NONAME', array(), 'admin'))); return false; } if ($group->getClassification() === null) { $form->addError(new FormError($this->get('translator')->trans('FORM.GROUP.NOCLASSIFICATION', array(), 'admin'))); return false; } return true; } return false; }