id; } public function getEndDate(): ?\DateTimeImmutable { return $this->endDate; } public function setEndDate(?\DateTimeImmutable $endDate): AccompanyingPeriodWorkReferrerHistory { $this->endDate = $endDate; return $this; } public function getAccompanyingPeriodWork(): AccompanyingPeriodWork { return $this->accompanyingPeriodWork; } public function getUser(): User { return $this->user; } public function getStartDate(): \DateTimeImmutable { return $this->startDate; } /** * to be used when the history is removed (when startDate = endDate). */ public function removeAccompanyingPeriodWork(): self { $this->accompanyingPeriodWork = null; return $this; } /** * @return bool true if the endDate is null */ public function isOpen(): bool { return null === $this->getEndDate(); } /** * return true if the date range is empty (start date and end date are equal). * * @return bool true if the start date and end date are equal */ public function isDateRangeEmpty(): bool { return $this->getStartDate()->format('Y-m-d') === $this->getEndDate()?->format('Y-m-d'); } }