diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php index f2161c78a..567e678e1 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php @@ -435,15 +435,16 @@ class AccompanyingPeriod return false; } - $participation = $this->getParticipationsContainsPerson($person); - if (!null === $participation) + $participation = $this->getOpenParticipationContainsPerson($person); + + if (null === $participation) { - $person = $participation->getPerson(); - $periods = $person->getAccompanyingPeriodsOrdered(); - return end($periods) === $this; + return false; } - return false; + $periods = $participation->getPerson()->getAccompanyingPeriodsOrdered(); + + return end($periods) === $this; } /**