person: create a person with address (and household without position (remove required position for household member)

This commit is contained in:
nobohan
2022-04-19 18:01:25 +02:00
parent c214c2f4a4
commit bad5506b98
8 changed files with 80 additions and 70 deletions

View File

@@ -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,7 +200,7 @@ class HouseholdMember
return $this;
}
public function setPosition(Position $position): self
public function setPosition(?Position $position): self
{
if ($this->position instanceof Position) {
throw new LogicException('The position is already set. You cannot change ' .
@@ -209,7 +208,9 @@ class HouseholdMember
}
$this->position = $position;
$this->shareHousehold = $position->getShareHousehold();
if (null !== $position){
$this->shareHousehold = $position->getShareHousehold();
}
return $this;
}