mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
[AccompanyingCourse location] Indicate course location on course index
page
This commit is contained in:
@@ -499,6 +499,17 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $collection->count() > 0 ? $collection->first() : NULL;
|
||||
}
|
||||
|
||||
public function getOPenParticipations(): Collection
|
||||
{
|
||||
return $this
|
||||
->getParticipations()
|
||||
->filter(
|
||||
static function(AccompanyingPeriodParticipation $participation): bool {
|
||||
return null === $participation->getEndDate();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the accompanying period contains a person.
|
||||
*
|
||||
@@ -974,6 +985,22 @@ class AccompanyingPeriod implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->personLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of person which have an adresse available for a valid location
|
||||
*
|
||||
* @return Collection|Person[]
|
||||
*/
|
||||
public function getAvailablePersonLocation(): Collection
|
||||
{
|
||||
return $this->getOPenParticipations()
|
||||
->filter(function(AccompanyingPeriodParticipation $p) {
|
||||
return $p->getPerson()->hasCurrentHouseholdAddress();
|
||||
})
|
||||
->map(function(AccompanyingPeriodParticipation $p) {
|
||||
return $p->getPerson();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @Groups({"write"})
|
||||
*/
|
||||
|
Reference in New Issue
Block a user