users = new ArrayCollection(); $this->customers = new ArrayCollection(); $this->projects = new ArrayCollection(); $this->activities = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function setName(string $name): Team { $this->name = $name; return $this; } public function getName(): ?string { return $this->name; } public function getTeamLead(): ?User { return $this->teamlead; } public function isTeamlead(User $user): bool { return $this->teamlead === $user; } public function setTeamLead(User $teamlead): Team { $this->teamlead = $teamlead; $this->addUser($teamlead); return $this; } public function hasUser(User $user): bool { return $this->users->contains($user); } public function addUser(User $user) { if ($this->users->contains($user)) { return; } $this->users->add($user); $user->addTeam($this); } public function removeUser(User $user) { if (!$this->users->contains($user)) { return; } $this->users->removeElement($user); $user->removeTeam($this); } /** * @return Collection */ public function getUsers(): iterable { return $this->users; } public function hasCustomer(Customer $customer): bool { return $this->customers->contains($customer); } public function addCustomer(Customer $customer) { if ($this->customers->contains($customer)) { return; } $this->customers->add($customer); $customer->addTeam($this); } public function removeCustomer(Customer $customer) { if (!$this->customers->contains($customer)) { return; } $this->customers->removeElement($customer); $customer->removeTeam($this); } /** * @return Collection */ public function getCustomers(): iterable { return $this->customers; } public function hasProject(Project $project): bool { return $this->projects->contains($project); } public function addProject(Project $project) { if ($this->projects->contains($project)) { return; } $this->projects->add($project); $project->addTeam($this); } public function removeProject(Project $project) { if (!$this->projects->contains($project)) { return; } $this->projects->removeElement($project); $project->removeTeam($this); } /** * @return Collection */ public function getProjects(): iterable { return $this->projects; } public function hasActivity(Activity $activity): bool { return $this->activities->contains($activity); } public function addActivity(Activity $activity) { if ($this->activities->contains($activity)) { return; } $this->activities->add($activity); $activity->addTeam($this); } public function removeActivity(Activity $activity) { if (!$this->activities->contains($activity)) { return; } $this->activities->removeElement($activity); $activity->removeTeam($this); } /** * @return Collection */ public function getActivities(): iterable { return $this->activities; } /** * @return string */ public function __toString() { return $this->getName(); } }