fix conflict + error on CommentType

This commit is contained in:
nobohan
2021-06-25 13:57:49 +02:00
11 changed files with 520 additions and 41 deletions

View File

@@ -23,13 +23,17 @@ namespace Chill\PersonBundle\Entity;
*/
use ArrayIterator;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Country;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\Household\Household;
use Chill\PersonBundle\Entity\MaritalStatus;
use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
@@ -53,7 +57,7 @@ use Chill\PersonBundle\Entity\Household\PersonHouseholdAddress;
* "person"=Person::class
* })
*/
class Person implements HasCenterInterface
class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateInterface
{
/**
* The person's id
@@ -100,6 +104,14 @@ class Person implements HasCenterInterface
*/
private $birthdate; //to change in birthdate
/**
* The person's deathdate
* @var \DateTimeImmutable
*
* @ORM\Column(type="date_immutable", nullable=true)
*/
private ?\DateTimeImmutable $deathdate;
/**
* The person's place of birth
* @var string
@@ -143,6 +155,14 @@ class Person implements HasCenterInterface
const MALE_GENDER = 'man';
const FEMALE_GENDER = 'woman';
const BOTH_GENDER = 'both';
const NO_INFORMATION = 'unknown';
/**
* Comment on gender
* @var CommentEmbeddable
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="genderComment_")
*/
private CommentEmbeddable $genderComment;
/**
* The marital status of the person
@@ -153,6 +173,21 @@ class Person implements HasCenterInterface
*/
private $maritalStatus;
/**
* The date of the last marital status change of the person
* @var \DateTime
*
* @ORM\Column(type="date", nullable=true)
*/
private $maritalStatusDate;
/**
* Comment on marital status
* @var CommentEmbeddable
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="maritalStatusComment_")
*/
private CommentEmbeddable $maritalStatusComment;
/**
* Contact information for contacting the person
* @var string
@@ -240,6 +275,54 @@ class Person implements HasCenterInterface
*/
private $memo = ''; // TO-CHANGE in remark
/**
* Accept short text message (aka SMS)
* @var boolean
*
* @ORM\Column(type="boolean", options={"default" : false})
*/
private ?bool $acceptSMS = false;
/**
* Accept receiving email
* @var boolean
*
* @ORM\Column(type="boolean", options={"default" : false})
*/
private ?bool $acceptEmail = false;
/**
* Number of children
* @var int
*
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $numberOfChildren = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
*/
private $createdBy;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private \DateTimeInterface $createdAt;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
private User $updatedBy;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private \DateTimeInterface $updatedAt;
/**
* @var boolean
* @deprecated
@@ -316,8 +399,10 @@ class Person implements HasCenterInterface
}
$this->open(new AccompanyingPeriod($opening));
$this->genderComment = new CommentEmbeddable();
$this->maritalStatusComment = new CommentEmbeddable();
}
/**
* This private function scan accompanyingPeriodParticipations Collection,
* searching for a given AccompanyingPeriod
@@ -329,10 +414,10 @@ class Person implements HasCenterInterface
if ($accompanyingPeriod === $participation->getAccompanyingPeriod()) {
return $participation;
}}
return null;
}
/**
* This public function is the same but return only true or false
*/
@@ -340,7 +425,7 @@ class Person implements HasCenterInterface
{
return ($this->participationsContainAccompanyingPeriod($accompanyingPeriod)) ? false : true;
}
/**
* Add AccompanyingPeriodParticipation
*
@@ -350,7 +435,7 @@ class Person implements HasCenterInterface
{
$participation = new AccompanyingPeriodParticipation($accompanyingPeriod, $this);
$this->accompanyingPeriodParticipations->add($participation);
return $this;
}
@@ -360,7 +445,7 @@ class Person implements HasCenterInterface
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) : void
{
$participation = $this->participationsContainAccompanyingPeriod($accompanyingPeriod);
if (! null === $participation) {
$participation->setEndDate(\DateTimeImmutable::class);
$this->accompanyingPeriodParticipations->removeElement($participation);
@@ -438,7 +523,7 @@ class Person implements HasCenterInterface
}
return $accompanyingPeriods;
}
/**
* Get AccompanyingPeriodParticipations Collection
*/
@@ -447,7 +532,7 @@ class Person implements HasCenterInterface
return $this->accompanyingPeriodParticipations;
}
/**
/**
* Return a collection of participation, where the participation
* is still opened, not a draft, and the period is still opened
*/
@@ -465,9 +550,9 @@ class Person implements HasCenterInterface
->filter(function (AccompanyingPeriodParticipation $app) {
$period = $app->getAccompanyingPeriod();
return (
NULL === $period->getClosingDate()
NULL === $period->getClosingDate()
|| new \DateTime('now') < $period->getClosingDate()
)
)
&& AccompanyingPeriod::STEP_DRAFT !== $period->getStep();
});
}
@@ -1195,12 +1280,12 @@ class Person implements HasCenterInterface
return true;
}
public function getFullnameCanonical() : string
{
return $this->fullnameCanonical;
}
public function setFullnameCanonical($fullnameCanonical) : Person
{
$this->fullnameCanonical = $fullnameCanonical;
@@ -1341,4 +1426,122 @@ class Person implements HasCenterInterface
return null;
}
}
public function getGenderComment(): CommentEmbeddable
{
return $this->genderComment;
}
public function setGenderComment(CommentEmbeddable $genderComment): self
{
$this->genderComment = $genderComment;
return $this;
}
public function getMaritalStatusComment(): CommentEmbeddable
{
return $this->maritalStatusComment;
}
public function setMaritalStatusComment(CommentEmbeddable $maritalStatusComment): self
{
$this->maritalStatusComment = $maritalStatusComment;
return $this;
}
public function getDeathdate(): ?\DateTimeInterface
{
return $this->deathdate;
}
public function setDeathdate(?\DateTimeInterface $deathdate): self
{
$this->deathdate = $deathdate;
return $this;
}
public function getMaritalStatusDate(): ?\DateTimeInterface
{
return $this->maritalStatusDate;
}
public function setMaritalStatusDate(?\DateTimeInterface $maritalStatusDate): self
{
$this->maritalStatusDate = $maritalStatusDate;
return $this;
}
public function getAcceptSMS(): ?bool
{
return $this->acceptSMS;
}
public function setAcceptSMS(bool $acceptSMS): self
{
$this->acceptSMS = $acceptSMS;
return $this;
}
public function getAcceptEmail(): ?bool
{
return $this->acceptEmail;
}
public function setAcceptEmail(bool $acceptEmail): self
{
$this->acceptEmail = $acceptEmail;
return $this;
}
public function getNumberOfChildren(): ?int
{
return $this->numberOfChildren;
}
public function setNumberOfChildren(int $numberOfChildren): self
{
$this->numberOfChildren = $numberOfChildren;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function setCreatedAt(\DateTimeInterface $datetime): self
{
$this->createdAt = $datetime;
return $this;
}
public function setUpdatedBy(User $user): self
{
$this->updatedBy = $user;
return $this;
}
public function setUpdatedAt(\DateTimeInterface $datetime): self
{
$this->updatedAt = $datetime;
return $this;
}
}