mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: add more fields on Person + migration
This commit is contained in:
parent
1b9d8fab61
commit
951160982d
@ -25,11 +25,13 @@ namespace Chill\PersonBundle\Entity;
|
||||
use ArrayIterator;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Country;
|
||||
use Chill\MainBundle\Entity\Language;
|
||||
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;
|
||||
@ -99,6 +101,14 @@ class Person implements HasCenterInterface
|
||||
*/
|
||||
private $birthdate; //to change in birthdate
|
||||
|
||||
/**
|
||||
* The person's deathdate
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
*/
|
||||
private $deathdate;
|
||||
|
||||
/**
|
||||
* The person's place of birth
|
||||
* @var string
|
||||
@ -142,6 +152,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 $genderComment;
|
||||
|
||||
/**
|
||||
* The marital status of the person
|
||||
@ -152,6 +170,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 $maritalStatusComment;
|
||||
|
||||
/**
|
||||
* Contact information for contacting the person
|
||||
* @var string
|
||||
@ -239,6 +272,31 @@ 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 $acceptSMS;
|
||||
|
||||
/**
|
||||
* Accept receiving email
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(type="boolean", options={"default" : false})
|
||||
*/
|
||||
private $acceptEmail;
|
||||
|
||||
/**
|
||||
* Number of children
|
||||
* @var int
|
||||
*
|
||||
* @ORM\Column(type="integer", options={"default" : 0})
|
||||
*/
|
||||
private $numberOfChildren;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @deprecated
|
||||
@ -306,6 +364,8 @@ class Person implements HasCenterInterface
|
||||
}
|
||||
|
||||
$this->open(new AccompanyingPeriod($opening));
|
||||
$this->genderComment = new CommentEmbeddable();
|
||||
$this->maritalStatusComment = new CommentEmbeddable();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1247,4 +1307,89 @@ class Person implements HasCenterInterface
|
||||
{
|
||||
return NULL !== $this->getCurrentHousehold($at);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ class GenderType extends AbstractType {
|
||||
$a = array(
|
||||
Person::MALE_GENDER => Person::MALE_GENDER,
|
||||
Person::FEMALE_GENDER => Person::FEMALE_GENDER,
|
||||
Person::BOTH_GENDER => Person::BOTH_GENDER
|
||||
Person::BOTH_GENDER => Person::BOTH_GENDER,
|
||||
Person::NO_INFORMATION => Person::NO_INFORMATION
|
||||
);
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\Migrations\Person;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
|
||||
/**
|
||||
* Add new fields to Person entity
|
||||
*/
|
||||
final class Version20210617073504 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Add new fields to Person entity';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD deathdate DATE DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusDate DATE DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD acceptSMS BOOLEAN DEFAULT false NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD acceptEmail BOOLEAN DEFAULT false NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD numberOfChildren INT DEFAULT 0 NOT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_comment TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_userId INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD genderComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_comment TEXT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_userId INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE chill_person_person ADD maritalStatusComment_date TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP deathdate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusDate');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptSMS');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP acceptEmail');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP numberOfChildren');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP genderComment_date');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_comment');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_userId');
|
||||
$this->addSql('ALTER TABLE chill_person_person DROP maritalStatusComment_date');
|
||||
}
|
||||
}
|
@ -56,6 +56,8 @@ Man: Homme
|
||||
Woman: Femme
|
||||
both: Indéterminé
|
||||
Both: Indéterminé
|
||||
unknown: Aucune information
|
||||
Unknown: Aucune information
|
||||
Divorced: Divorcé(e)
|
||||
Separated: Séparé(e)
|
||||
Widow: Veuf(ve)
|
||||
|
Loading…
x
Reference in New Issue
Block a user