mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Fix: force the consistency of location in accompanying period
- internally, the entity remove the addressLocation when the personLocation is set, and vice-versa; - this commit add a migration which may solve the case when both case happens (priority to personLocation + keep the history) - add a constraint on the database to avoid such situation
This commit is contained in:
@@ -786,7 +786,7 @@ class AccompanyingPeriod implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|AccompanyingPeriodLocationHistory[]
|
||||
* @return Collection<AccompanyingPeriodLocationHistory>
|
||||
*/
|
||||
public function getLocationHistories(): Collection
|
||||
{
|
||||
@@ -797,6 +797,7 @@ class AccompanyingPeriod implements
|
||||
* Get where the location is.
|
||||
*
|
||||
* @Groups({"read"})
|
||||
* @return 'person'|'address'|'none'
|
||||
*/
|
||||
public function getLocationStatus(): string
|
||||
{
|
||||
@@ -1209,6 +1210,7 @@ class AccompanyingPeriod implements
|
||||
$this->addressLocation = $addressLocation;
|
||||
|
||||
if (null !== $addressLocation) {
|
||||
$this->setPersonLocation(null);
|
||||
$locationHistory = new AccompanyingPeriodLocationHistory();
|
||||
$locationHistory
|
||||
->setStartDate(new DateTimeImmutable('now'))
|
||||
@@ -1327,6 +1329,7 @@ class AccompanyingPeriod implements
|
||||
$this->personLocation = $person;
|
||||
|
||||
if (null !== $person) {
|
||||
$this->setAddressLocation(null);
|
||||
$locationHistory = new AccompanyingPeriodLocationHistory();
|
||||
$locationHistory
|
||||
->setStartDate(new DateTimeImmutable('now'))
|
||||
|
Reference in New Issue
Block a user