documents = new ArrayCollection(); } public function addDocument(AccompanyingPeriodWorkEvaluationDocument $document): self { if (!$this->documents->contains($document)) { $this->documents[] = $document; $document->setAccompanyingPeriodWorkEvaluation($this); } return $this; } public function getAccompanyingPeriodWork(): ?AccompanyingPeriodWork { return $this->accompanyingPeriodWork; } public function getComment(): string { return $this->comment; } public function getCreatedAt(): ?DateTimeImmutable { return $this->createdAt; } public function getCreatedBy(): ?User { return $this->createdBy; } /** * @return Collection */ public function getDocuments() { return $this->documents; } public function getEndDate(): ?DateTimeImmutable { return $this->endDate; } public function getEvaluation(): ?Evaluation { return $this->evaluation; } public function getId(): ?int { return $this->id; } /** * Arbitrary data, used for client. * * @return mixed */ public function getKey() { return $this->key; } public function getMaxDate(): ?DateTimeImmutable { return $this->maxDate; } public function getStartDate(): ?DateTimeImmutable { return $this->startDate; } public function getUpdatedAt(): ?DateTimeImmutable { return $this->updatedAt; } public function getUpdatedBy(): ?User { return $this->updatedBy; } /** * @Serializer\Groups({"docgen:read"}) */ public function getWarningDate(): ?DateTimeImmutable { if (null === $this->getEndDate() || null === $this->getWarningInterval()) { return null; } return $this->getEndDate()->sub($this->getWarningInterval()); } public function getWarningInterval(): ?DateInterval { return $this->warningInterval; } public function removeDocument(AccompanyingPeriodWorkEvaluationDocument $document): self { $this->documents->removeElement($document); $document->setAccompanyingPeriodWorkEvaluation(null); return $this; } public function setAccompanyingPeriodWork(?AccompanyingPeriodWork $accompanyingPeriodWork): AccompanyingPeriodWorkEvaluation { if ( $accompanyingPeriodWork instanceof AccompanyingPeriodWork && $this->accompanyingPeriodWork instanceof AccompanyingPeriodWork && $this->accompanyingPeriodWork->getId() !== $accompanyingPeriodWork->getId() ) { throw new RuntimeException('Changing the ' . 'accompanyingPeriodWork is not allowed'); } $this->accompanyingPeriodWork = $accompanyingPeriodWork; return $this; } public function setComment(string $comment): AccompanyingPeriodWorkEvaluation { $this->comment = $comment; return $this; } /** * @param DateTimeImmutable|null $createdAt * * @return AccompanyingPeriodWorkEvaluation */ public function setCreatedAt(DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function setCreatedBy(?User $createdBy): AccompanyingPeriodWorkEvaluation { $this->createdBy = $createdBy; return $this; } public function setEndDate(?DateTimeImmutable $endDate): AccompanyingPeriodWorkEvaluation { $this->endDate = $endDate; return $this; } public function setEvaluation(?Evaluation $evaluation): AccompanyingPeriodWorkEvaluation { if ( ($evaluation instanceof Evaluation && $this->evaluation instanceof Evaluation && $evaluation->getId() !== $this->evaluation->getId()) || ($this->evaluation instanceof Evaluation && null === $evaluation) ) { $cl = AccompanyingPeriodWorkEvaluation::class; throw new LogicException("once set, an {$cl} cannot change or remove the linked Evaluation::class"); } $this->evaluation = $evaluation; return $this; } /** * Arbitrary data, used for client. * * @param mixed $key * * @return AccompanyingPeriodWorkEvaluation */ public function setKey($key): self { $this->key = $key; return $this; } public function setMaxDate(?DateTimeImmutable $maxDate): AccompanyingPeriodWorkEvaluation { $this->maxDate = $maxDate; return $this; } public function setStartDate(?DateTimeImmutable $startDate): AccompanyingPeriodWorkEvaluation { $this->startDate = $startDate; return $this; } /** * @param DateTimeImmutable|null $updatedAt * * @return AccompanyingPeriodWorkEvaluation */ public function setUpdatedAt(DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function setUpdatedBy(?User $updatedBy): AccompanyingPeriodWorkEvaluation { $this->updatedBy = $updatedBy; return $this; } public function setWarningInterval(?DateInterval $warningInterval): AccompanyingPeriodWorkEvaluation { $this->warningInterval = $warningInterval; return $this; } }