sf4 deprecated: migrate Doctrine ORM mapping to annotation

This commit is contained in:
Tchama 2020-07-24 16:46:46 +02:00
parent 97d3afba9b
commit d39666bf8e
10 changed files with 423 additions and 286 deletions

View File

@ -28,36 +28,74 @@ use Chill\MainBundle\Entity\User;
/** /**
* AccompanyingPeriod * AccompanyingPeriod
*
* @ORM\Entity()
* @ORM\Table(name="chill_person_accompanying_period")
*/ */
class AccompanyingPeriod class AccompanyingPeriod
{ {
/** @var integer */ /**
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id; private $id;
/** @var \DateTime */ /**
* @var \DateTime
*
* @ORM\Column(type="date")
*/
private $openingDate; private $openingDate;
/** @var \DateTime */ /**
private $closingDate; * @var \DateTime
*
* @ORM\Column(type="date", nullable=true)
*/
private $closingDate = null;
/** @var string */ /**
* @var string
*
* @ORM\Column(type="text")
*/
private $remark = ''; private $remark = '';
/** @var \Chill\PersonBundle\Entity\Person */ /**
* @var Person
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="accompanyingPeriods",
* cascade={"refresh"})
*/
private $person; private $person;
/** @var AccompanyingPeriod\ClosingMotive */ /**
* @var AccompanyingPeriod\ClosingMotive
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
* @ORM\JoinColumn(nullable=true)
*/
private $closingMotive = null; private $closingMotive = null;
/** /**
* The user making the accompanying * The user making the accompanying
*
* @var User * @var User
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @ORM\JoinColumn(nullable=true)
*/ */
private $user; private $user;
/** /**
* * AccompanyingPeriod constructor.
*
* @param \DateTime $dateOpening * @param \DateTime $dateOpening
* @uses AccompanyingPeriod::setClosingDate() * @uses AccompanyingPeriod::setClosingDate()
*/ */
@ -125,7 +163,6 @@ class AccompanyingPeriod
} }
/** /**
*
* @return boolean * @return boolean
*/ */
public function isOpen(): bool public function isOpen(): bool
@ -170,14 +207,14 @@ class AccompanyingPeriod
/** /**
* Set person. * Set person.
* *
* For consistency, you should use Person::addAccompanyingPeriod instead. * For consistency, you should use Person::addAccompanyingPeriod instead.
* *
* @param \Chill\PersonBundle\Entity\Person $person * @param Person $person
* @return AccompanyingPeriod * @return AccompanyingPeriod
* @see Person::addAccompanyingPeriod * @see Person::addAccompanyingPeriod
*/ */
public function setPerson(\Chill\PersonBundle\Entity\Person $person = null) public function setPerson(Person $person = null)
{ {
$this->person = $person; $this->person = $person;
@ -187,18 +224,25 @@ class AccompanyingPeriod
/** /**
* Get person * Get person
* *
* @return \Chill\PersonBundle\Entity\Person * @return Person
*/ */
public function getPerson() public function getPerson()
{ {
return $this->person; return $this->person;
} }
/**
* @return AccompanyingPeriod\ClosingMotive
*/
public function getClosingMotive() public function getClosingMotive()
{ {
return $this->closingMotive; return $this->closingMotive;
} }
/**
* @param AccompanyingPeriod\ClosingMotive|null $closingMotive
* @return $this
*/
public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null) public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null)
{ {
$this->closingMotive = $closingMotive; $this->closingMotive = $closingMotive;
@ -224,14 +268,19 @@ class AccompanyingPeriod
return end($periods) === $this; return end($periods) === $this;
} }
/**
*/
public function reOpen() public function reOpen()
{ {
$this->setClosingDate(null); $this->setClosingDate(null);
$this->setClosingMotive(null); $this->setClosingMotive(null);
} }
/// VALIDATION function /**
public function isDateConsistent(ExecutionContextInterface $context) { * Validation function
*/
public function isDateConsistent(ExecutionContextInterface $context)
{
if ($this->isOpen()) { if ($this->isOpen()) {
return; return;
} }
@ -248,7 +297,8 @@ class AccompanyingPeriod
* *
* @return boolean * @return boolean
*/ */
public function isClosingAfterOpening() { public function isClosingAfterOpening()
{
$diff = $this->getOpeningDate()->diff($this->getClosingDate()); $diff = $this->getOpeningDate()->diff($this->getClosingDate());
if ($diff->invert === 0) { if ($diff->invert === 0) {
@ -258,11 +308,18 @@ class AccompanyingPeriod
} }
} }
/**
* @return User|null
*/
function getUser(): ?User function getUser(): ?User
{ {
return $this->user; return $this->user;
} }
/**
* @param User $user
* @return AccompanyingPeriod
*/
function setUser(User $user): self function setUser(User $user): self
{ {
$this->user = $user; $this->user = $user;
@ -270,5 +327,4 @@ class AccompanyingPeriod
return $this; return $this;
} }
} }

View File

@ -20,51 +20,75 @@
namespace Chill\PersonBundle\Entity\AccompanyingPeriod; namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
/** /**
* ClosingMotive give an explanation why we closed the Accompanying period * ClosingMotive give an explanation why we closed the Accompanying period
*
* @ORM\Entity(
* repositoryClass="Chill\PersonBundle\Repository\ClosingMotiveRepository")
* @ORM\Table(name="chill_person_closingmotive")
*/ */
class ClosingMotive class ClosingMotive
{ {
/** /**
* @var integer * @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
* @var array * @var array
*
* @ORM\Column(type="json_array")
*/ */
private $name; private $name;
/** /**
*
* @var boolean * @var boolean
*
* @ORM\Column(type="boolean")
*/ */
private $active = true; private $active = true;
/** /**
*
* @var self * @var self
*
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* inversedBy="children")
*/ */
private $parent = null; private $parent = null;
/** /**
* child Accompanying periods * Child Accompanying periods
*
* @var Collection * @var Collection
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
* mappedBy="parent")
*/ */
private $children; private $children;
/** /**
*
* @var float * @var float
*
* @ORM\Column(type="float")
*/ */
private $ordering = 0.0; private $ordering = 0.0;
/**
* ClosingMotive constructor.
*/
public function __construct() public function __construct()
{ {
$this->children = new \Doctrine\Common\Collections\ArrayCollection(); $this->children = new ArrayCollection();
} }
/** /**
@ -101,11 +125,18 @@ class ClosingMotive
return $this->name; return $this->name;
} }
/**
* @return bool
*/
public function isActive(): bool public function isActive(): bool
{ {
return $this->active; return $this->active;
} }
/**
* @param bool $active
* @return $this
*/
public function setActive(bool $active) public function setActive(bool $active)
{ {
$this->active = $active; $this->active = $active;
@ -118,17 +149,27 @@ class ClosingMotive
return $this; return $this;
} }
/**
* @return ClosingMotive
*/
public function getParent() public function getParent()
{ {
return $this->parent; return $this->parent;
} }
/**
* @return Collection
*/
public function getChildren(): Collection public function getChildren(): Collection
{ {
return $this->children; return $this->children;
} }
/**
* @param ClosingMotive|null $parent
* @return ClosingMotive
*/
public function setParent(?ClosingMotive $parent): ClosingMotive public function setParent(?ClosingMotive $parent): ClosingMotive
{ {
$this->parent = $parent; $this->parent = $parent;
@ -139,7 +180,11 @@ class ClosingMotive
return $this; return $this;
} }
/**
* @param Collection $children
* @return ClosingMotive
*/
public function setChildren(Collection $children): ClosingMotive public function setChildren(Collection $children): ClosingMotive
{ {
$this->children = $children; $this->children = $children;
@ -147,6 +192,10 @@ class ClosingMotive
return $this; return $this;
} }
/**
* @param ClosingMotive $child
* @return ClosingMotive
*/
public function addChildren(ClosingMotive $child): ClosingMotive public function addChildren(ClosingMotive $child): ClosingMotive
{ {
if ($this->children->contains($child)) { if ($this->children->contains($child)) {
@ -159,6 +208,10 @@ class ClosingMotive
return $this; return $this;
} }
/**
* @param ClosingMotive $child
* @return ClosingMotive
*/
public function removeChildren(ClosingMotive $child): ClosingMotive public function removeChildren(ClosingMotive $child): ClosingMotive
{ {
if ($this->children->removeElement($child)) { if ($this->children->removeElement($child)) {
@ -168,33 +221,52 @@ class ClosingMotive
return $this; return $this;
} }
/**
* @return float
*/
public function getOrdering(): float public function getOrdering(): float
{ {
return $this->ordering; return $this->ordering;
} }
/**
* @param float $ordering
* @return $this
*/
public function setOrdering(float $ordering) public function setOrdering(float $ordering)
{ {
$this->ordering = $ordering; $this->ordering = $ordering;
return $this; return $this;
} }
/**
* @return bool
*/
public function isChild(): bool public function isChild(): bool
{ {
return $this->parent !== null; return $this->parent !== null;
} }
/**
* @return bool
*/
public function isParent(): bool public function isParent(): bool
{ {
return $this->children->count() > 0; return $this->children->count() > 0;
} }
/**
* @return bool
*/
public function isLeaf(): bool public function isLeaf(): bool
{ {
return $this->children->count() === 0; return $this->children->count() === 0;
} }
/**
* @return bool
*/
public function hasParent(): bool public function hasParent(): bool
{ {
return $this->parent !== null; return $this->parent !== null;

View File

@ -20,18 +20,28 @@
namespace Chill\PersonBundle\Entity; namespace Chill\PersonBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/** /**
* MaritalStatus * MaritalStatus
*
* @ORM\Entity()
* @ORM\Table(name="chill_person_marital_status")
* @ORM\HasLifecycleCallbacks()
*/ */
class MaritalStatus class MaritalStatus
{ {
/** /**
* @var string * @var string
*
* @ORM\Id()
* @ORM\Column(type="string", length=7)
*/ */
private $id; private $id;
/** /**
* @var string array * @var string array
* @ORM\Column(type="json_array")
*/ */
private $name; private $name;

View File

@ -22,110 +22,248 @@ namespace Chill\PersonBundle\Entity;
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
use Symfony\Component\Validator\Context\ExecutionContextInterface; use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Criteria;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Entity\Country;
use Chill\PersonBundle\Entity\MaritalStatus; use Chill\PersonBundle\Entity\MaritalStatus;
use Doctrine\Common\Collections\ArrayCollection;
use Chill\MainBundle\Entity\HasCenterInterface; use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Address;
use Doctrine\Common\Collections\Criteria; use Symfony\Component\Validator\Context\ExecutionContextInterface;
/** /**
* Person * Person Class
*
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonRepository")
* @ORM\Table(name="chill_person_person",
* indexes={@ORM\Index(
* name="person_names",
* columns={"firstName", "lastName"}
* )})
* sf4 check index name
* @ORM\HasLifecycleCallbacks()
*/ */
class Person implements HasCenterInterface { class Person implements HasCenterInterface
/** @var integer The person's id */ {
/**
* The person's id
* @var integer
*
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id; private $id;
/** @var string The person's first name */ /**
* The person's first name
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $firstName; private $firstName;
/** @var string The person's last name */ /**
* The person's last name
* @var string
*
* @ORM\Column(type="string", length=255)
*/
private $lastName; private $lastName;
/** /**
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\PersonAltName",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"},
* orphanRemoval=true)
*/ */
private $altNames; private $altNames;
/** @var \DateTime The person's birthdate */ /**
* The person's birthdate
* @var \DateTime
*
* @ORM\Column(type="date", nullable=true)
*/
private $birthdate; //to change in birthdate private $birthdate; //to change in birthdate
/** @var string The person's place of birth */ /**
* The person's place of birth
* @var string
*
* @ORM\Column(type="string", length=255, name="place_of_birth")
*/
private $placeOfBirth = ''; private $placeOfBirth = '';
/** @var \Chill\MainBundle\Entity\Country The person's country of birth */ /**
* The person's country of birth
* @var Country
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*
* sf4 check: option inversedBy="birthsIn" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/
private $countryOfBirth; private $countryOfBirth;
/** @var \Chill\MainBundle\Entity\Country The person's nationality */ /**
* The person's nationality
* @var Country
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Country")
*
* sf4 check: option inversedBy="nationals" return error mapping !!
*
* @ORM\JoinColumn(nullable=true)
*/
private $nationality; private $nationality;
/** @var string The person's gender */ /**
* The person's gender
* @var string
*
* @ORM\Column(type="string", length=9, nullable=true)
*/
private $gender; private $gender;
const MALE_GENDER = 'man'; const MALE_GENDER = 'man';
const FEMALE_GENDER = 'woman'; const FEMALE_GENDER = 'woman';
const BOTH_GENDER = 'both'; const BOTH_GENDER = 'both';
/** @var \Chill\PersonBundle\Entity\MaritalStatus The marital status of the person */ /**
* The marital status of the person
* @var MaritalStatus
*
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\MaritalStatus")
* @ORM\JoinColumn(nullable=true)
*/
private $maritalStatus; private $maritalStatus;
/** @var string Contact information for contacting the person */ /**
* Contact information for contacting the person
* @var string
*
* @ORM\Column(type="text", nullable=true)
*/
private $contactInfo = ''; private $contactInfo = '';
/** @var string The person's email */ /**
* The person's email
* @var string
*
* @ORM\Column(type="text", nullable=true)
*/
private $email = ''; private $email = '';
/** @var string The person's phonenumber */ /**
* The person's phonenumber
* @var string
*
* @ORM\Column(type="text", length=40, nullable=true)
*/
private $phonenumber = ''; private $phonenumber = '';
/** @var string The person's mobile phone number */ /**
* The person's mobile phone number
* @var string
*
* @ORM\Column(type="text", length=40, nullable=true)
*/
private $mobilenumber = ''; private $mobilenumber = '';
//TO-ADD : caseOpeningDate //TO-ADD caseOpeningDate
//TO-ADD nativeLanguag //TO-ADD nativeLanguag
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection The person's spoken * The person's spoken languages
* languages (ArrayCollection of Languages) * @var ArrayCollection
*
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\Language")
* @ORM\JoinTable(
* name="persons_spoken_languages",
* joinColumns={@ORM\JoinColumn(name="person_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="language_id", referencedColumnName="id")}
* )
*/ */
private $spokenLanguages; private $spokenLanguages;
/** @var \Chill\MainBundle\Entity\Center The person's center */ /**
* The person's center
* @var Center
*
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")
* @ORM\JoinColumn(nullable=false)
*/
private $center; private $center;
/** /**
* @var \Doctrine\Common\Collections\ArrayCollection The person's * The person's accompanying periods (when the person was accompanied by the center)
* accompanying periods (when the person was accompanied by the center)*/ * @var ArrayCollection
*
* @ORM\OneToMany(
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod",
* mappedBy="person",
* cascade={"persist", "remove", "merge", "detach"})
*/
private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory private $accompanyingPeriods; //TO-CHANGE in accompanyingHistory
/** @var string A remark over the person */ /**
* A remark over the person
* @var string
*
* @ORM\Column(type="text")
*/
private $memo = ''; // TO-CHANGE in remark private $memo = ''; // TO-CHANGE in remark
/** /**
* @var boolean * @var boolean
* @deprecated * @deprecated
*
* @ORM\Column(type="boolean")
*/ */
private $proxyAccompanyingPeriodOpenState = false; //TO-DELETE ? private $proxyAccompanyingPeriodOpenState = false; //TO-DELETE ?
/**
/** @var array Array where customfield's data are stored */ * Array where customfield's data are stored
* @var array
*
* @ORM\Column(type="json_array")
*/
private $cFData; private $cFData;
/** /**
* Addresses
* @var Collection
* *
* @var \Doctrine\Common\Collections\Collection * @ORM\ManyToMany(
* targetEntity="Chill\MainBundle\Entity\Address",
* cascade={"persist", "remove", "merge", "detach"})
* @ORM\JoinTable(name="chill_person_persons_to_addresses")
* @ORM\OrderBy({"validFrom" = "DESC"})
*/ */
private $addresses; private $addresses;
/** /**
* @var string * @var string
*
* @ORM\Column(type="text", nullable=true)
*/ */
private $fullnameCanonical; private $fullnameCanonical;
public function __construct(\DateTime $opening = null) {
/**
* Person constructor.
*
* @param \DateTime|null $opening
*/
public function __construct(\DateTime $opening = null)
{
$this->accompanyingPeriods = new ArrayCollection(); $this->accompanyingPeriods = new ArrayCollection();
$this->spokenLanguages = new ArrayCollection(); $this->spokenLanguages = new ArrayCollection();
$this->addresses = new ArrayCollection(); $this->addresses = new ArrayCollection();
@ -139,15 +277,20 @@ class Person implements HasCenterInterface {
} }
/** /**
* @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod * @param AccompanyingPeriod $accompanyingPeriod
* @uses AccompanyingPeriod::setPerson * @uses AccompanyingPeriod::setPerson
*/ */
public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) { public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod)
{
$accompanyingPeriod->setPerson($this); $accompanyingPeriod->setPerson($this);
$this->accompanyingPeriods->add($accompanyingPeriod); $this->accompanyingPeriods->add($accompanyingPeriod);
} }
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) { /**
* @param AccompanyingPeriod $accompanyingPeriod
*/
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod)
{
$this->accompanyingPeriods->remove($accompanyingPeriod); $this->accompanyingPeriods->remove($accompanyingPeriod);
} }
@ -161,15 +304,15 @@ class Person implements HasCenterInterface {
* *
* To check if the Person and its accompanying period is consistent, use validation. * To check if the Person and its accompanying period is consistent, use validation.
* *
* @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod * @param AccompanyingPeriod $accompanyingPeriod
*/ */
public function open(AccompanyingPeriod $accompanyingPeriod) { public function open(AccompanyingPeriod $accompanyingPeriod)
{
$this->proxyAccompanyingPeriodOpenState = true; $this->proxyAccompanyingPeriodOpenState = true;
$this->addAccompanyingPeriod($accompanyingPeriod); $this->addAccompanyingPeriod($accompanyingPeriod);
} }
/** /**
*
* Set the Person file as closed at the given date. * Set the Person file as closed at the given date.
* *
* For update a closing date, you should update AccompanyingPeriod instance * For update a closing date, you should update AccompanyingPeriod instance
@ -190,7 +333,8 @@ class Person implements HasCenterInterface {
* *
* @return AccompanyingPeriod * @return AccompanyingPeriod
*/ */
public function getOpenedAccompanyingPeriod() { public function getOpenedAccompanyingPeriod()
{
if ($this->isOpen() === false) { if ($this->isOpen() === false) {
return null; return null;
} }
@ -214,10 +358,10 @@ class Person implements HasCenterInterface {
} }
/** /**
* * @return ArrayCollection
* @return \Doctrine\Common\Collections\ArrayCollection
*/ */
public function getAccompanyingPeriods() { public function getAccompanyingPeriods()
{
return $this->accompanyingPeriods; return $this->accompanyingPeriods;
} }
@ -227,7 +371,8 @@ class Person implements HasCenterInterface {
* *
* @return AccompanyingPeriod[] * @return AccompanyingPeriod[]
*/ */
public function getAccompanyingPeriodsOrdered() { public function getAccompanyingPeriodsOrdered()
{
$periods = $this->getAccompanyingPeriods()->toArray(); $periods = $this->getAccompanyingPeriods()->toArray();
//order by date : //order by date :
@ -332,18 +477,29 @@ class Person implements HasCenterInterface {
return $this->lastName; return $this->lastName;
} }
public function getAltNames(): \Doctrine\Common\Collections\Collection /**
* @return Collection
*/
public function getAltNames(): Collection
{ {
return $this->altNames; return $this->altNames;
} }
public function setAltNames(\Doctrine\Common\Collections\Collection $altNames) /**
* @param Collection $altNames
* @return $this
*/
public function setAltNames(Collection $altNames)
{ {
$this->altNames = $altNames; $this->altNames = $altNames;
return $this; return $this;
} }
/**
* @param PersonAltName $altName
* @return $this
*/
public function addAltName(PersonAltName $altName) public function addAltName(PersonAltName $altName)
{ {
if (FALSE === $this->altNames->contains($altName)) { if (FALSE === $this->altNames->contains($altName)) {
@ -354,6 +510,10 @@ class Person implements HasCenterInterface {
return $this; return $this;
} }
/**
* @param PersonAltName $altName
* @return $this
*/
public function removeAltName(PersonAltName $altName) public function removeAltName(PersonAltName $altName)
{ {
if ($this->altNames->contains($altName)) { if ($this->altNames->contains($altName)) {
@ -387,7 +547,6 @@ class Person implements HasCenterInterface {
return $this->birthdate; return $this->birthdate;
} }
/** /**
* Set placeOfBirth * Set placeOfBirth
* *
@ -443,7 +602,8 @@ class Person implements HasCenterInterface {
* This is used for translations * This is used for translations
* @return int * @return int
*/ */
public function getGenderNumeric() { public function getGenderNumeric()
{
if ($this->getGender() == self::FEMALE_GENDER) { if ($this->getGender() == self::FEMALE_GENDER) {
return 1; return 1;
} else { } else {
@ -483,7 +643,7 @@ class Person implements HasCenterInterface {
/** /**
* Set maritalStatus * Set maritalStatus
* *
* @param \Chill\PersonBundle\Entity\MaritalStatus $maritalStatus * @param MaritalStatus $maritalStatus
* @return Person * @return Person
*/ */
public function setMaritalStatus(MaritalStatus $maritalStatus = null) public function setMaritalStatus(MaritalStatus $maritalStatus = null)
@ -495,7 +655,7 @@ class Person implements HasCenterInterface {
/** /**
* Get maritalStatus * Get maritalStatus
* *
* @return \Chill\PersonBundle\Entity\MaritalStatus * @return MaritalStatus
*/ */
public function getMaritalStatus() public function getMaritalStatus()
{ {
@ -600,15 +760,19 @@ class Person implements HasCenterInterface {
{ {
return $this->nationality; return $this->nationality;
} }
public function getLabel() { /**
* @return string
*/
public function getLabel()
{
return $this->getFirstName()." ".$this->getLastName(); return $this->getFirstName()." ".$this->getLastName();
} }
/** /**
* Get center * Get center
* *
* @return \Chill\MainBundle\Entity\Center * @return Center
*/ */
public function getCenter() public function getCenter()
{ {
@ -618,16 +782,15 @@ class Person implements HasCenterInterface {
/** /**
* Set the center * Set the center
* *
* @param \Chill\MainBundle\Entity\Center $center * @param Center $center
* @return \Chill\PersonBundle\Entity\Person * @return \Chill\PersonBundle\Entity\Person
*/ */
public function setCenter(\Chill\MainBundle\Entity\Center $center) public function setCenter(Center $center)
{ {
$this->center = $center; $this->center = $center;
return $this; return $this;
} }
/** /**
* Set cFData * Set cFData
* *
@ -700,7 +863,10 @@ class Person implements HasCenterInterface {
{ {
return $this->mobilenumber; return $this->mobilenumber;
} }
/**
* @return string
*/
public function __toString() public function __toString()
{ {
return $this->getLabel(); return $this->getLabel();
@ -728,14 +894,21 @@ class Person implements HasCenterInterface {
{ {
return $this->spokenLanguages; return $this->spokenLanguages;
} }
/**
* @param Address $address
* @return $this
*/
public function addAddress(Address $address) public function addAddress(Address $address)
{ {
$this->addresses[] = $address; $this->addresses[] = $address;
return $this; return $this;
} }
/**
* @param Address $address
*/
public function removeAddress(Address $address) public function removeAddress(Address $address)
{ {
$this->addresses->removeElement($address); $this->addresses->removeElement($address);
@ -751,7 +924,11 @@ class Person implements HasCenterInterface {
{ {
return $this->addresses; return $this->addresses;
} }
/**
* @param \DateTime|null $date
* @return null
*/
public function getLastAddress(\DateTime $date = null) public function getLastAddress(\DateTime $date = null)
{ {
if ($date === null) { if ($date === null) {

View File

@ -7,13 +7,13 @@ use Doctrine\ORM\Mapping as ORM;
/** /**
* PersonAltName * PersonAltName
* *
* @ORM\Table(name="person_alt_name") * @ORM\Table(name="chill_person_alt_name")
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository") * @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
*/ */
class PersonAltName class PersonAltName
{ {
/** /**
* @var int * @var integer
* *
* @ORM\Column(name="id", type="integer") * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
@ -36,16 +36,16 @@ class PersonAltName
private $label; private $label;
/** /**
*
* @var Person * @var Person
* @ORM\OneToMany( *
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person", * targetEntity="Chill\PersonBundle\Entity\Person",
* mappedBy="altNames" * inversedBy="altNames"
* ) * )
*/ */
private $person; private $person;
/** /**
* Get id. * Get id.
* *
@ -104,11 +104,18 @@ class PersonAltName
return $this->label; return $this->label;
} }
/**
* @return Person
*/
public function getPerson(): Person public function getPerson(): Person
{ {
return $this->person; return $this->person;
} }
/**
* @param Person|null $person
* @return $this
*/
public function setPerson(?Person $person = null) public function setPerson(?Person $person = null)
{ {
$this->person = $person; $this->person = $person;

View File

@ -1,26 +0,0 @@
Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive:
table: chill_person_closingmotive
type: entity
repositoryClass: Chill\PersonBundle\Repository\ClosingMotiveRepository
id:
id:
type: integer
id: true
generator: { strategy: AUTO }
fields:
name:
type: json_array
active:
type: boolean
ordering:
type: float
options:
default: 0.0
oneToMany:
children:
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
mappedBy: parent
manyToOne:
parent:
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
inversedBy: children

View File

@ -1,28 +0,0 @@
Chill\PersonBundle\Entity\AccompanyingPeriod:
table: chill_person_accompanying_period
type: entity
id:
id:
type: integer
id: true
generator: { strategy: AUTO }
fields:
openingDate:
type: date
closingDate:
type: date
default: null
nullable: true
remark:
type: text
manyToOne:
person:
targetEntity: Person
inversedBy: accompanyingPeriods
cascade: [refresh]
closingMotive:
targetEntity: Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive
nullable: true
user:
targetEntity: Chill\MainBundle\Entity\User
nullable: true

View File

@ -1,11 +0,0 @@
Chill\PersonBundle\Entity\MaritalStatus:
table: chill_person_marital_status
type: entity
id:
id:
type: string
length: 7
fields:
name:
type: json_array
lifecycleCallbacks: { }

View File

@ -1,99 +0,0 @@
Chill\PersonBundle\Entity\Person:
type: entity
table: chill_person_person
indexes:
person_names:
columns: [firstName, lastName]
repositoryClass: Chill\PersonBundle\Repository\PersonRepository
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
firstName:
type: string
length: 255
lastName:
type: string
length: 255
birthdate:
type: date
nullable: true
placeOfBirth:
type: string
length: 255
column: place_of_birth
default: ''
gender:
type: string
length: 9
nullable: true
memo:
type: text
default: ''
contactInfo:
type: text
nullable: true
email:
type: text
nullable: true
proxyAccompanyingPeriodOpenState:
type: boolean
name: proxy_open
cFData:
type: json_array
phonenumber:
type: text
nullable: true
length: 40
mobilenumber:
type: text
nullable: true
length: 40
fullnameCanonical:
type: text
nullable: true
manyToOne:
countryOfBirth:
targetEntity: Chill\MainBundle\Entity\Country
inversedBy: birthsIn
nullable: true
nationality:
targetEntity: Chill\MainBundle\Entity\Country
inversedBy: nationals
nullable: true
center:
targetEntity: Chill\MainBundle\Entity\Center
nullable: false
maritalStatus:
targetEntity: Chill\PersonBundle\Entity\MaritalStatus
nullable: true
oneToMany:
accompanyingPeriods:
targetEntity: AccompanyingPeriod
mappedBy: person
cascade: [persist, remove, merge, detach]
altNames:
targetEntity: PersonAltName
mappedBy: person
cascade: [persist, remove, merge, detach]
orphanRemoval: true
manyToMany:
spokenLanguages:
targetEntity: Chill\MainBundle\Entity\Language
joinTable:
name: persons_spoken_languages
joinColumns:
person_id:
referencedColumnName: id
inverseJoinColumns:
language_id:
referencedColumnName: id
addresses:
targetEntity: Chill\MainBundle\Entity\Address
orderBy: { 'validFrom': 'DESC' }
joinTable:
name: chill_person_persons_to_addresses
cascade: [persist, remove, merge, detach]
lifecycleCallbacks: { }

View File

@ -1,21 +0,0 @@
Chill\PersonBundle\Entity\PersonAltName:
type: entity
table: chill_person_alt_name
repositoryClass: Chill\PersonBundle\Repository\PersonAltNameRepository
id:
id:
type: integer
id: true
generator:
strategy: AUTO
fields:
key:
type: string
length: 255
label:
type: text
manyToOne:
person:
targetEntity: Person
inversedBy: altNames