mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
method added to get current accompanying periods + api adjusted
This commit is contained in:
@@ -613,6 +613,26 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
||||
return $accompanyingPeriods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current accompanyingPeriods array
|
||||
*/
|
||||
public function getCurrentAccompanyingPeriods(): array
|
||||
{
|
||||
$currentAccompanyingPeriods = [];
|
||||
$currentDate = new DateTime();
|
||||
|
||||
foreach ($this->accompanyingPeriodParticipations as $participation)
|
||||
{
|
||||
$endDate = $participation->getEndDate();
|
||||
|
||||
if ($endDate === null || $endDate > $currentDate){
|
||||
$currentAccompanyingPeriods[] = $participation->getAccompanyingPeriod();
|
||||
}
|
||||
}
|
||||
|
||||
return $currentAccompanyingPeriods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AccompanyingPeriodParticipations Collection
|
||||
*
|
||||
|
Reference in New Issue
Block a user