Historique ménage pour une personne

This commit is contained in:
2021-06-15 17:03:38 +02:00
parent efdfd10e49
commit e95d8fbc7a
9 changed files with 420 additions and 5 deletions

View File

@@ -1209,14 +1209,44 @@ class Person implements HasCenterInterface
return $this->householdParticipations;
}
/**
* Get participation where the person does share the household.
*
* Order by startDate, desc
*/
public function getHouseholdParticipationsShareHousehold(): Collection
{
$criteria = new Criteria();
$expr = Criteria::expr();
$criteria->where(
$expr->eq('shareHousehold', true)
);
$criteria
->where(
$expr->eq('shareHousehold', true)
)
->orderBy(['startDate' => Criteria::DESC])
;
return $this->getHouseholdParticipations()
->matching($criteria)
;
}
/**
* Get participation where the person does not share the household.
*
* Order by startDate, desc
*/
public function getHouseholdParticipationsNotShareHousehold(): Collection
{
$criteria = new Criteria();
$expr = Criteria::expr();
$criteria
->where(
$expr->eq('shareHousehold', false)
)
->orderBy(['startDate' => Criteria::DESC])
;
return $this->getHouseholdParticipations()
->matching($criteria)