From 62d8d4d253311edec74e5a579efdd7af7271688e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 6 Dec 2023 18:14:23 +0100 Subject: [PATCH] chore: add utility methods --- src/Entity/Assignment.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Entity/Assignment.php b/src/Entity/Assignment.php index a10127f..7c61689 100644 --- a/src/Entity/Assignment.php +++ b/src/Entity/Assignment.php @@ -116,8 +116,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa ->setPickupDate($assignment->getPickupDate()) ->setPickup($assignment->getPickup()) ->setBenefits($assignment->getBenefits()) - ->setContact($assignment->getContact()) - ; + ->setContact($assignment->getContact()); $assignment->getFees()->map(function (Fee $fee) use ($instance) { $instance->addFee($fee); @@ -224,6 +223,24 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa return null; } + public function getEffectiveDateFrom(): ?\DateTimeImmutable + { + if (null !== $effectivePeriod = $this->getEffectivePeriod()) { + return $effectivePeriod->start->toDateTimeImmutable(); + } + + return null; + } + + public function getEffectiveDateTo(): ?\DateTimeImmutable + { + if (null !== $effectivePeriod = $this->getEffectivePeriod()) { + return $effectivePeriod->end->toDateTimeImmutable(); + } + + return null; + } + public function getEffectivePickupDate(): ?\DateTimeImmutable { if (null !== $this->pickupDate) {