Merge branch 'features/household-validation' into features/household-edit-members-forms-improve-household

This commit is contained in:
2021-06-17 22:46:47 +02:00
42 changed files with 1674 additions and 42 deletions

View File

@@ -1219,6 +1219,50 @@ 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)
)
->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)
;
}
public function getCurrentHousehold(?\DateTimeImmutable $at = null): ?Household
{
$criteria = new Criteria();