mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
handle event PersonMoveEvent on Period
This commit is contained in:
@@ -217,7 +217,7 @@ class AccompanyingPeriod implements
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodLocationHistory::class,
|
||||
* mappedBy="period", cascade="{"persist", "remove""}, orphanRemoval=true)
|
||||
* mappedBy="period", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
*/
|
||||
private Collection $locationHistories;
|
||||
|
||||
@@ -709,6 +709,17 @@ class AccompanyingPeriod implements
|
||||
return $this->job;
|
||||
}
|
||||
|
||||
public function getLastLocationHistory(): ?AccompanyingPeriodLocationHistory
|
||||
{
|
||||
foreach ($this->getLocationHistories() as $locationHistory) {
|
||||
if (null === $locationHistory->getEndDate()) {
|
||||
return $locationHistory;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the location, taking precedence into account.
|
||||
*
|
||||
@@ -723,6 +734,9 @@ class AccompanyingPeriod implements
|
||||
return $this->getAddressLocation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|AccompanyingPeriodLocationHistory[]
|
||||
*/
|
||||
public function getLocationHistories(): Collection
|
||||
{
|
||||
return $this->locationHistories;
|
||||
|
@@ -66,6 +66,7 @@ class AccompanyingPeriodParticipation
|
||||
$this->startDate = new DateTime('now');
|
||||
$this->accompanyingPeriod = $accompanyingPeriod;
|
||||
$this->person = $person;
|
||||
$person->getAccompanyingPeriodParticipations()->add($this);
|
||||
}
|
||||
|
||||
public function getAccompanyingPeriod(): ?AccompanyingPeriod
|
||||
|
Reference in New Issue
Block a user