teamers = new ArrayCollection(); } public static function duplicate(Availability $availability): static { $instance = new static(); $instance ->setDateFrom($availability->getDateFrom()) ->setDateTo($availability->getDateTo()) ->setDescription($availability->getDescription()) ; return $instance; } public function __toString() { return sprintf('%s - %s', $this->getDateFrom()->format('d.m.Y'), $this->getDateTo()->format('d.m.Y')); } public function getId(): ?int { return $this->id; } public function getDateFrom(): ?\DateTimeImmutable { return $this->dateFrom; } public function setDateFrom(?\DateTimeImmutable $dateFrom): static { $this->dateFrom = $dateFrom; return $this; } public function getDateTo(): ?\DateTimeImmutable { return $this->dateTo; } public function setDateTo(?\DateTimeImmutable $dateTo): static { $this->dateTo = $dateTo; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getOwner(): ?Teamer { return $this->owner; } public function setOwner(?Teamer $owner): static { $this->owner = $owner; return $this; } /** * @return Collection */ public function getTeamers(): Collection { return $this->teamers; } public function addTeamer(Teamer $teamer): static { if (!$this->teamers->contains($teamer)) { $this->teamers->add($teamer); $teamer->addAvailability($this); } return $this; } public function removeTeamer(Teamer $teamer): static { if ($this->teamers->removeElement($teamer)) { $teamer->removeAvailability($this); } return $this; } }