From 6f2c219e3bf4bb50c01dfd07e0394e6e3ac1bf07 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 10 Jun 2021 11:43:13 +0200 Subject: [PATCH] household address: add validTo computation in Address --- src/Bundle/ChillPersonBundle/Entity/Household/Household.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index 6caafde3e..c4c11b918 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -68,6 +68,11 @@ class Household { $this->addresses[] = $address; + foreach ($this->getAddresses() as $a) { + if ($a->getValidFrom() < $address->getValidFrom() && $a->getValidTo() === NULL) { + $a->setValidTo($address->getValidFrom()); + } + } return $this; }