add model + form to handle alt names

This commit is contained in:
2020-01-30 15:51:39 +01:00
parent 7b7ce4a604
commit 426458811c
14 changed files with 482 additions and 2 deletions

View File

@@ -42,6 +42,12 @@ class Person implements HasCenterInterface {
/** @var string The person's last name */
private $lastName;
/**
*
* @var \Doctrine\Common\Collections\Collection
*/
private $altNames;
/** @var \DateTime The person's birthdate */
private $birthdate; //to change in birthdate
@@ -123,6 +129,7 @@ class Person implements HasCenterInterface {
$this->accompanyingPeriods = new ArrayCollection();
$this->spokenLanguages = new ArrayCollection();
$this->addresses = new ArrayCollection();
$this->altNames = new ArrayCollection();
if ($opening === null) {
$opening = new \DateTime();
@@ -324,7 +331,39 @@ class Person implements HasCenterInterface {
{
return $this->lastName;
}
public function getAltNames(): \Doctrine\Common\Collections\Collection
{
return $this->altNames;
}
public function setAltNames(\Doctrine\Common\Collections\Collection $altNames)
{
$this->altNames = $altNames;
return $this;
}
public function addAltName(PersonAltName $altName)
{
if (FALSE === $this->altNames->contains($altName)) {
$this->altNames->add($altName);
$altName->setPerson($this);
}
return $this;
}
public function removeAltName(PersonAltName $altName)
{
if ($this->altNames->contains($altName)) {
$altName->setPerson(null);
$this->altNames->removeElement($altName);
}
return $this;
}
/**
* Set birthdate
*