mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
rewrite methods for participation
This commit is contained in:
@@ -384,9 +384,9 @@ class AccompanyingPeriod
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Person
|
||||
* Open a new participation for a person
|
||||
*/
|
||||
public function addPerson(Person $person = null): AccompanyingPeriodParticipation
|
||||
public function createParticipationFor(Person $person): AccompanyingPeriodParticipation
|
||||
{
|
||||
$participation = new AccompanyingPeriodParticipation($this, $person);
|
||||
$this->participations[] = $participation;
|
||||
@@ -394,10 +394,24 @@ class AccompanyingPeriod
|
||||
return $participation;
|
||||
}
|
||||
|
||||
public function addPerson(Person $person = null): self
|
||||
{
|
||||
if (NULL !== $person) {
|
||||
$this->createParticipationFor($person);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Person
|
||||
* Close a participation for a person
|
||||
*
|
||||
* Search for the person's participation and set the end date at
|
||||
* 'now'.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removePerson(Person $person): ?AccompanyingPeriodParticipation
|
||||
public function closeParticipationFor($person): ?AccompanyingPeriodParticipation
|
||||
{
|
||||
$participation = $this->getOpenParticipationContainsPerson($person);
|
||||
|
||||
@@ -407,6 +421,17 @@ class AccompanyingPeriod
|
||||
|
||||
return $participation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove Person
|
||||
*/
|
||||
public function removePerson(Person $person): self
|
||||
{
|
||||
$this->closeParticipationFor($person);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getClosingMotive(): ?ClosingMotive
|
||||
|
Reference in New Issue
Block a user