mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
sf4 deprecated: migrate Doctrine ORM mapping to annotation
This commit is contained in:
parent
97d3afba9b
commit
d39666bf8e
@ -28,36 +28,74 @@ use Chill\MainBundle\Entity\User;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriod
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="chill_person_accompanying_period")
|
||||
*/
|
||||
class AccompanyingPeriod
|
||||
{
|
||||
/** @var integer */
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/** @var \DateTime */
|
||||
/**
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(type="date")
|
||||
*/
|
||||
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 = '';
|
||||
|
||||
/** @var \Chill\PersonBundle\Entity\Person */
|
||||
/**
|
||||
* @var Person
|
||||
*
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||
* inversedBy="accompanyingPeriods",
|
||||
* cascade={"refresh"})
|
||||
*/
|
||||
private $person;
|
||||
|
||||
/** @var AccompanyingPeriod\ClosingMotive */
|
||||
/**
|
||||
* @var AccompanyingPeriod\ClosingMotive
|
||||
*
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $closingMotive = null;
|
||||
|
||||
/**
|
||||
* The user making the accompanying
|
||||
*
|
||||
* @var User
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
|
||||
* @ORM\JoinColumn(nullable=true)
|
||||
*/
|
||||
private $user;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* AccompanyingPeriod constructor.
|
||||
*
|
||||
* @param \DateTime $dateOpening
|
||||
* @uses AccompanyingPeriod::setClosingDate()
|
||||
*/
|
||||
@ -125,7 +163,6 @@ class AccompanyingPeriod
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isOpen(): bool
|
||||
@ -170,14 +207,14 @@ class AccompanyingPeriod
|
||||
|
||||
/**
|
||||
* Set person.
|
||||
*
|
||||
*
|
||||
* For consistency, you should use Person::addAccompanyingPeriod instead.
|
||||
*
|
||||
* @param \Chill\PersonBundle\Entity\Person $person
|
||||
* @param Person $person
|
||||
* @return AccompanyingPeriod
|
||||
* @see Person::addAccompanyingPeriod
|
||||
*/
|
||||
public function setPerson(\Chill\PersonBundle\Entity\Person $person = null)
|
||||
public function setPerson(Person $person = null)
|
||||
{
|
||||
$this->person = $person;
|
||||
|
||||
@ -187,18 +224,25 @@ class AccompanyingPeriod
|
||||
/**
|
||||
* Get person
|
||||
*
|
||||
* @return \Chill\PersonBundle\Entity\Person
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson()
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AccompanyingPeriod\ClosingMotive
|
||||
*/
|
||||
public function getClosingMotive()
|
||||
{
|
||||
return $this->closingMotive;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param AccompanyingPeriod\ClosingMotive|null $closingMotive
|
||||
* @return $this
|
||||
*/
|
||||
public function setClosingMotive(AccompanyingPeriod\ClosingMotive $closingMotive = null)
|
||||
{
|
||||
$this->closingMotive = $closingMotive;
|
||||
@ -224,14 +268,19 @@ class AccompanyingPeriod
|
||||
return end($periods) === $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function reOpen()
|
||||
{
|
||||
$this->setClosingDate(null);
|
||||
$this->setClosingMotive(null);
|
||||
}
|
||||
|
||||
/// VALIDATION function
|
||||
public function isDateConsistent(ExecutionContextInterface $context) {
|
||||
/**
|
||||
* Validation function
|
||||
*/
|
||||
public function isDateConsistent(ExecutionContextInterface $context)
|
||||
{
|
||||
if ($this->isOpen()) {
|
||||
return;
|
||||
}
|
||||
@ -248,7 +297,8 @@ class AccompanyingPeriod
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isClosingAfterOpening() {
|
||||
public function isClosingAfterOpening()
|
||||
{
|
||||
$diff = $this->getOpeningDate()->diff($this->getClosingDate());
|
||||
|
||||
if ($diff->invert === 0) {
|
||||
@ -258,11 +308,18 @@ class AccompanyingPeriod
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User|null
|
||||
*/
|
||||
function getUser(): ?User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
function setUser(User $user): self
|
||||
{
|
||||
$this->user = $user;
|
||||
@ -270,5 +327,4 @@ class AccompanyingPeriod
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -20,51 +20,75 @@
|
||||
|
||||
namespace Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var boolean
|
||||
*
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
private $active = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var self
|
||||
*
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||
* inversedBy="children")
|
||||
*/
|
||||
private $parent = null;
|
||||
|
||||
/**
|
||||
* child Accompanying periods
|
||||
*
|
||||
* Child Accompanying periods
|
||||
* @var Collection
|
||||
*
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\ClosingMotive",
|
||||
* mappedBy="parent")
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var float
|
||||
*
|
||||
* @ORM\Column(type="float")
|
||||
*/
|
||||
private $ordering = 0.0;
|
||||
|
||||
|
||||
/**
|
||||
* ClosingMotive constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new \Doctrine\Common\Collections\ArrayCollection();
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,11 +125,18 @@ class ClosingMotive
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
return $this->active;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bool $active
|
||||
* @return $this
|
||||
*/
|
||||
public function setActive(bool $active)
|
||||
{
|
||||
$this->active = $active;
|
||||
@ -118,17 +149,27 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getChildren(): Collection
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ClosingMotive|null $parent
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function setParent(?ClosingMotive $parent): ClosingMotive
|
||||
{
|
||||
$this->parent = $parent;
|
||||
@ -139,7 +180,11 @@ class ClosingMotive
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $children
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function setChildren(Collection $children): ClosingMotive
|
||||
{
|
||||
$this->children = $children;
|
||||
@ -147,6 +192,10 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClosingMotive $child
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function addChildren(ClosingMotive $child): ClosingMotive
|
||||
{
|
||||
if ($this->children->contains($child)) {
|
||||
@ -159,6 +208,10 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ClosingMotive $child
|
||||
* @return ClosingMotive
|
||||
*/
|
||||
public function removeChildren(ClosingMotive $child): ClosingMotive
|
||||
{
|
||||
if ($this->children->removeElement($child)) {
|
||||
@ -168,33 +221,52 @@ class ClosingMotive
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
public function getOrdering(): float
|
||||
{
|
||||
return $this->ordering;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float $ordering
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrdering(float $ordering)
|
||||
{
|
||||
$this->ordering = $ordering;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isChild(): bool
|
||||
{
|
||||
return $this->parent !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isParent(): bool
|
||||
{
|
||||
return $this->children->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLeaf(): bool
|
||||
{
|
||||
return $this->children->count() === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasParent(): bool
|
||||
{
|
||||
return $this->parent !== null;
|
||||
|
@ -20,18 +20,28 @@
|
||||
|
||||
namespace Chill\PersonBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* MaritalStatus
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Table(name="chill_person_marital_status")
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
*/
|
||||
class MaritalStatus
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Id()
|
||||
* @ORM\Column(type="string", length=7)
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @var string array
|
||||
* @ORM\Column(type="json_array")
|
||||
*/
|
||||
private $name;
|
||||
|
||||
|
@ -22,110 +22,248 @@ namespace Chill\PersonBundle\Entity;
|
||||
* 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\PersonBundle\Entity\MaritalStatus;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Chill\MainBundle\Entity\HasCenterInterface;
|
||||
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 {
|
||||
/** @var integer The person's id */
|
||||
class Person implements HasCenterInterface
|
||||
{
|
||||
/**
|
||||
* The person's id
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Id
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/** @var string The person's first name */
|
||||
/**
|
||||
* The person's first name
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*/
|
||||
private $firstName;
|
||||
|
||||
/** @var string The person's last name */
|
||||
/**
|
||||
* The person's last name
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=255)
|
||||
*/
|
||||
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;
|
||||
|
||||
/** @var \DateTime The person's birthdate */
|
||||
/**
|
||||
* The person's birthdate
|
||||
* @var \DateTime
|
||||
*
|
||||
* @ORM\Column(type="date", nullable=true)
|
||||
*/
|
||||
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 = '';
|
||||
|
||||
/** @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;
|
||||
|
||||
/** @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;
|
||||
|
||||
/** @var string The person's gender */
|
||||
/**
|
||||
* The person's gender
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="string", length=9, nullable=true)
|
||||
*/
|
||||
private $gender;
|
||||
|
||||
const MALE_GENDER = 'man';
|
||||
const FEMALE_GENDER = 'woman';
|
||||
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;
|
||||
|
||||
/** @var string Contact information for contacting the person */
|
||||
/**
|
||||
* Contact information for contacting the person
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $contactInfo = '';
|
||||
|
||||
/** @var string The person's email */
|
||||
/**
|
||||
* The person's email
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $email = '';
|
||||
|
||||
/** @var string The person's phonenumber */
|
||||
/**
|
||||
* The person's phonenumber
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="text", length=40, nullable=true)
|
||||
*/
|
||||
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 = '';
|
||||
|
||||
//TO-ADD : caseOpeningDate
|
||||
|
||||
//TO-ADD caseOpeningDate
|
||||
//TO-ADD nativeLanguag
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's spoken
|
||||
* languages (ArrayCollection of Languages)
|
||||
* The person's spoken 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;
|
||||
|
||||
/** @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;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\Common\Collections\ArrayCollection The person's
|
||||
* accompanying periods (when the person was accompanied by the center)*/
|
||||
* The person's 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
|
||||
|
||||
/** @var string A remark over the person */
|
||||
/**
|
||||
* A remark over the person
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="text")
|
||||
*/
|
||||
private $memo = ''; // TO-CHANGE in remark
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
* @deprecated
|
||||
*
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
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->spokenLanguages = 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
|
||||
*/
|
||||
public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) {
|
||||
public function addAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod)
|
||||
{
|
||||
$accompanyingPeriod->setPerson($this);
|
||||
$this->accompanyingPeriods->add($accompanyingPeriod);
|
||||
}
|
||||
|
||||
public function removeAccompanyingPeriod(AccompanyingPeriod $accompanyingPeriod) {
|
||||
|
||||
/**
|
||||
* @param AccompanyingPeriod $accompanyingPeriod
|
||||
*/
|
||||
public function removeAccompanyingPeriod(AccompanyingPeriod $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.
|
||||
*
|
||||
* @param \Chill\PersonBundle\Entity\AccompanyingPeriod $accompanyingPeriod
|
||||
* @param AccompanyingPeriod $accompanyingPeriod
|
||||
*/
|
||||
public function open(AccompanyingPeriod $accompanyingPeriod) {
|
||||
public function open(AccompanyingPeriod $accompanyingPeriod)
|
||||
{
|
||||
$this->proxyAccompanyingPeriodOpenState = true;
|
||||
$this->addAccompanyingPeriod($accompanyingPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Set the Person file as closed at the given date.
|
||||
*
|
||||
* For update a closing date, you should update AccompanyingPeriod instance
|
||||
@ -190,7 +333,8 @@ class Person implements HasCenterInterface {
|
||||
*
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
public function getOpenedAccompanyingPeriod() {
|
||||
public function getOpenedAccompanyingPeriod()
|
||||
{
|
||||
if ($this->isOpen() === false) {
|
||||
return null;
|
||||
}
|
||||
@ -214,10 +358,10 @@ class Person implements HasCenterInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\ArrayCollection
|
||||
* @return ArrayCollection
|
||||
*/
|
||||
public function getAccompanyingPeriods() {
|
||||
public function getAccompanyingPeriods()
|
||||
{
|
||||
return $this->accompanyingPeriods;
|
||||
}
|
||||
|
||||
@ -227,7 +371,8 @@ class Person implements HasCenterInterface {
|
||||
*
|
||||
* @return AccompanyingPeriod[]
|
||||
*/
|
||||
public function getAccompanyingPeriodsOrdered() {
|
||||
public function getAccompanyingPeriodsOrdered()
|
||||
{
|
||||
$periods = $this->getAccompanyingPeriods()->toArray();
|
||||
|
||||
//order by date :
|
||||
@ -332,18 +477,29 @@ class Person implements HasCenterInterface {
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
public function getAltNames(): \Doctrine\Common\Collections\Collection
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getAltNames(): Collection
|
||||
{
|
||||
return $this->altNames;
|
||||
}
|
||||
|
||||
public function setAltNames(\Doctrine\Common\Collections\Collection $altNames)
|
||||
|
||||
/**
|
||||
* @param Collection $altNames
|
||||
* @return $this
|
||||
*/
|
||||
public function setAltNames(Collection $altNames)
|
||||
{
|
||||
$this->altNames = $altNames;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param PersonAltName $altName
|
||||
* @return $this
|
||||
*/
|
||||
public function addAltName(PersonAltName $altName)
|
||||
{
|
||||
if (FALSE === $this->altNames->contains($altName)) {
|
||||
@ -354,6 +510,10 @@ class Person implements HasCenterInterface {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PersonAltName $altName
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAltName(PersonAltName $altName)
|
||||
{
|
||||
if ($this->altNames->contains($altName)) {
|
||||
@ -387,7 +547,6 @@ class Person implements HasCenterInterface {
|
||||
return $this->birthdate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set placeOfBirth
|
||||
*
|
||||
@ -443,7 +602,8 @@ class Person implements HasCenterInterface {
|
||||
* This is used for translations
|
||||
* @return int
|
||||
*/
|
||||
public function getGenderNumeric() {
|
||||
public function getGenderNumeric()
|
||||
{
|
||||
if ($this->getGender() == self::FEMALE_GENDER) {
|
||||
return 1;
|
||||
} else {
|
||||
@ -483,7 +643,7 @@ class Person implements HasCenterInterface {
|
||||
/**
|
||||
* Set maritalStatus
|
||||
*
|
||||
* @param \Chill\PersonBundle\Entity\MaritalStatus $maritalStatus
|
||||
* @param MaritalStatus $maritalStatus
|
||||
* @return Person
|
||||
*/
|
||||
public function setMaritalStatus(MaritalStatus $maritalStatus = null)
|
||||
@ -495,7 +655,7 @@ class Person implements HasCenterInterface {
|
||||
/**
|
||||
* Get maritalStatus
|
||||
*
|
||||
* @return \Chill\PersonBundle\Entity\MaritalStatus
|
||||
* @return MaritalStatus
|
||||
*/
|
||||
public function getMaritalStatus()
|
||||
{
|
||||
@ -600,15 +760,19 @@ class Person implements HasCenterInterface {
|
||||
{
|
||||
return $this->nationality;
|
||||
}
|
||||
|
||||
public function getLabel() {
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->getFirstName()." ".$this->getLastName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get center
|
||||
*
|
||||
* @return \Chill\MainBundle\Entity\Center
|
||||
* @return Center
|
||||
*/
|
||||
public function getCenter()
|
||||
{
|
||||
@ -618,16 +782,15 @@ class Person implements HasCenterInterface {
|
||||
/**
|
||||
* Set the center
|
||||
*
|
||||
* @param \Chill\MainBundle\Entity\Center $center
|
||||
* @param Center $center
|
||||
* @return \Chill\PersonBundle\Entity\Person
|
||||
*/
|
||||
public function setCenter(\Chill\MainBundle\Entity\Center $center)
|
||||
public function setCenter(Center $center)
|
||||
{
|
||||
$this->center = $center;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set cFData
|
||||
*
|
||||
@ -700,7 +863,10 @@ class Person implements HasCenterInterface {
|
||||
{
|
||||
return $this->mobilenumber;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getLabel();
|
||||
@ -728,14 +894,21 @@ class Person implements HasCenterInterface {
|
||||
{
|
||||
return $this->spokenLanguages;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Address $address
|
||||
* @return $this
|
||||
*/
|
||||
public function addAddress(Address $address)
|
||||
{
|
||||
$this->addresses[] = $address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Address $address
|
||||
*/
|
||||
public function removeAddress(Address $address)
|
||||
{
|
||||
$this->addresses->removeElement($address);
|
||||
@ -751,7 +924,11 @@ class Person implements HasCenterInterface {
|
||||
{
|
||||
return $this->addresses;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param \DateTime|null $date
|
||||
* @return null
|
||||
*/
|
||||
public function getLastAddress(\DateTime $date = null)
|
||||
{
|
||||
if ($date === null) {
|
||||
|
@ -7,13 +7,13 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
/**
|
||||
* PersonAltName
|
||||
*
|
||||
* @ORM\Table(name="person_alt_name")
|
||||
* @ORM\Table(name="chill_person_alt_name")
|
||||
* @ORM\Entity(repositoryClass="Chill\PersonBundle\Repository\PersonAltNameRepository")
|
||||
*/
|
||||
class PersonAltName
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
@ -36,16 +36,16 @@ class PersonAltName
|
||||
private $label;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Person
|
||||
* @ORM\OneToMany(
|
||||
*
|
||||
* @ORM\ManyToOne(
|
||||
* targetEntity="Chill\PersonBundle\Entity\Person",
|
||||
* mappedBy="altNames"
|
||||
* inversedBy="altNames"
|
||||
* )
|
||||
*/
|
||||
private $person;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get id.
|
||||
*
|
||||
@ -104,11 +104,18 @@ class PersonAltName
|
||||
return $this->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Person
|
||||
*/
|
||||
public function getPerson(): Person
|
||||
{
|
||||
return $this->person;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Person|null $person
|
||||
* @return $this
|
||||
*/
|
||||
public function setPerson(?Person $person = null)
|
||||
{
|
||||
$this->person = $person;
|
||||
|
@ -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
|
@ -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
|
@ -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: { }
|
@ -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: { }
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user