Merge branch 'features/household-members-list' into features/household-editor

This commit is contained in:
2021-06-08 22:16:43 +02:00
10 changed files with 115 additions and 23 deletions

View File

@@ -98,7 +98,7 @@ class Household
return $this->members;
}
public function getCurrentMembers(\DateTimeImmutable $now = null): Collection
public function getCurrentMembers(?\DateTimeImmutable $now = null): Collection
{
$criteria = new Criteria();
$expr = Criteria::expr();
@@ -118,6 +118,19 @@ class Household
return $this->getMembers()->matching($criteria);
}
/**
* Get the persons currently associated to the household.
*
* Return a list of Person, instead of a list of HouseholdMembers
*
* @return Person[]
*/
public function getCurrentPersons(?\DateTimeImmutable $now = null): Collection
{
return $this->getCurrentMembers($now)
->map(function(HouseholdMember $m) { return $m->getPerson(); });
}
public function getNonCurrentMembers(\DateTimeImmutable $now = null): Collection
{
$criteria = new Criteria();