mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
bootstrap api and apply on accompanying period
This commit is contained in:
@@ -118,7 +118,7 @@ class AccompanyingPeriod
|
||||
*
|
||||
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
|
||||
* mappedBy="accompanyingPeriod",
|
||||
* cascade={"persist", "remove", "merge", "detach"})
|
||||
* cascade={"persist", "refresh", "remove", "merge", "detach"})
|
||||
*/
|
||||
private $participations;
|
||||
|
||||
@@ -348,7 +348,7 @@ class AccompanyingPeriod
|
||||
*/
|
||||
public function getParticipationsContainsPerson(Person $person): Collection
|
||||
{
|
||||
return $this->getParticipations()->filter(
|
||||
return $this->getParticipations($person)->filter(
|
||||
function(AccompanyingPeriodParticipation $participation) use ($person) {
|
||||
if ($person === $participation->getPerson()) {
|
||||
return $participation;
|
||||
@@ -361,11 +361,11 @@ class AccompanyingPeriod
|
||||
*
|
||||
* "Open" means that the closed date is NULL
|
||||
*/
|
||||
public function getOpenParticipationsContainsPerson(Person $person): ?AccompanyingPeriodParticipation
|
||||
public function getOpenParticipationContainsPerson(Person $person): ?AccompanyingPeriodParticipation
|
||||
{
|
||||
$collection = $this->getParticipationsContainsPerson()->filter(
|
||||
$collection = $this->getParticipationsContainsPerson($person)->filter(
|
||||
function(AccompanyingPeriodParticipation $participation) use ($person) {
|
||||
if (NULL === $participation->getClosingDate()) {
|
||||
if (NULL === $participation->getEndDate()) {
|
||||
return $participation;
|
||||
}
|
||||
});
|
||||
@@ -380,7 +380,7 @@ class AccompanyingPeriod
|
||||
*/
|
||||
public function containsPerson(Person $person): bool
|
||||
{
|
||||
return $this->participationsContainsPerson($person)->count() > 0;
|
||||
return $this->getParticipationsContainsPerson($person)->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user