Merge remote-tracking branch 'origin/master' into issue596_admin_user

This commit is contained in:
2022-05-13 15:08:49 +02:00
47 changed files with 916 additions and 212 deletions

View File

@@ -35,7 +35,7 @@ class HouseholdMember
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
* @Serializer\Groups({"read", "docgen:read"})
* @Assert\GreaterThan(
* @Assert\GreaterThanOrEqual(
* propertyPath="startDate",
* message="household_membership.The end date must be after start date",
* groups={"household_memberships"}
@@ -82,14 +82,13 @@ class HouseholdMember
/**
* @ORM\ManyToOne(targetEntity=Position::class)
* @Serializer\Groups({"read", "docgen:read"})
* @Assert\NotNull(groups={"household_memberships_created"})
*/
private ?Position $position = null;
/**
* @ORM\Column(type="boolean", name="sharedhousehold")
*/
private bool $shareHousehold = false;
private bool $shareHousehold = true;
/**
* @ORM\Column(type="date_immutable", nullable=true, options={"default": null})
@@ -201,15 +200,18 @@ class HouseholdMember
return $this;
}
public function setPosition(Position $position): self
public function setPosition(?Position $position): self
{
if ($this->position instanceof Position) {
if ($this->position instanceof Position && $this->position !== $position) {
throw new LogicException('The position is already set. You cannot change ' .
'a position of a membership');
}
$this->position = $position;
$this->shareHousehold = $position->getShareHousehold();
if (null !== $position) {
$this->shareHousehold = $position->getShareHousehold();
}
return $this;
}