mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
fix person
This commit is contained in:
parent
9e65354cfc
commit
9d313dd68f
@ -12,7 +12,7 @@ use Chill\PersonBundle\Entity\Person;
|
|||||||
*
|
*
|
||||||
* @author Julien Fastré <julien arobase fastre point info>
|
* @author Julien Fastré <julien arobase fastre point info>
|
||||||
*/
|
*/
|
||||||
class LoadPeople extends AbstractFixture {
|
class LoadPeople extends AbstractFixture implements OrderedFixtureInterface {
|
||||||
|
|
||||||
public function prepare() {
|
public function prepare() {
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class LoadPeople extends AbstractFixture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getOrder() {
|
public function getOrder() {
|
||||||
return 1302;
|
return 10000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class LoadPeople extends AbstractFixture {
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
echo "add a person...";
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|
||||||
$sex = $this->genres[array_rand($this->genres)];
|
$sex = $this->genres[array_rand($this->genres)];
|
||||||
@ -86,9 +86,6 @@ class LoadPeople extends AbstractFixture {
|
|||||||
'DateOfBirth' => "1960-10-12",
|
'DateOfBirth' => "1960-10-12",
|
||||||
'PlaceOfBirth' => "Ottignies Louvain-La-Neuve",
|
'PlaceOfBirth' => "Ottignies Louvain-La-Neuve",
|
||||||
'Genre' => $sex,
|
'Genre' => $sex,
|
||||||
'CivilUnion' => $this->CivilUnions[array_rand($this->CivilUnions)],
|
|
||||||
'NbOfChild' => $this->NbOfChild[array_rand($this->NbOfChild)],
|
|
||||||
'BelgianNationalNumber' => '811016-269-24',
|
|
||||||
'Email' => "Email d'un ami: roger@tt.com",
|
'Email' => "Email d'un ami: roger@tt.com",
|
||||||
'CountryOfBirth' => 'France',
|
'CountryOfBirth' => 'France',
|
||||||
'Nationality' => 'Russie'
|
'Nationality' => 'Russie'
|
||||||
@ -112,6 +109,8 @@ class LoadPeople extends AbstractFixture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$manager->persist($p);
|
$manager->persist($p);
|
||||||
|
echo "add person'".$p->__toString()."'\n";
|
||||||
|
|
||||||
} while ($i <= 100);
|
} while ($i <= 100);
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
@ -135,11 +134,6 @@ class LoadPeople extends AbstractFixture {
|
|||||||
|
|
||||||
private $genres = array(Person::GENRE_MAN, Person::GENRE_WOMAN);
|
private $genres = array(Person::GENRE_MAN, Person::GENRE_WOMAN);
|
||||||
|
|
||||||
private $CivilUnions = array(Person::CIVIL_COHAB, Person::CIVIL_DIVORCED,
|
|
||||||
Person::CIVIL_SEPARATED, Person::CIVIL_SINGLE, Person::CIVIL_UNKNOW,
|
|
||||||
Person::CIVIL_WIDOW);
|
|
||||||
|
|
||||||
private $NbOfChild = array(0, 0, 1, 1, 1, 1, 1, 2, 2, 3, 4, 5, 6);
|
|
||||||
|
|
||||||
private $years = array();
|
private $years = array();
|
||||||
|
|
||||||
@ -154,9 +148,6 @@ class LoadPeople extends AbstractFixture {
|
|||||||
'DateOfBirth' => "1960-10-12",
|
'DateOfBirth' => "1960-10-12",
|
||||||
'PlaceOfBirth' => "Ottignies Louvain-La-Neuve",
|
'PlaceOfBirth' => "Ottignies Louvain-La-Neuve",
|
||||||
'Genre' => Person::GENRE_MAN,
|
'Genre' => Person::GENRE_MAN,
|
||||||
'CivilUnion' => Person::CIVIL_DIVORCED,
|
|
||||||
'NbOfChild' => 0,
|
|
||||||
'BelgianNationalNumber' => '12-10-16-269-24',
|
|
||||||
'Email' => "Email d'un ami: roger@tt.com",
|
'Email' => "Email d'un ami: roger@tt.com",
|
||||||
'CountryOfBirth' => 'France',
|
'CountryOfBirth' => 'France',
|
||||||
'Nationality' => 'Russie'
|
'Nationality' => 'Russie'
|
||||||
|
@ -2,16 +2,13 @@
|
|||||||
|
|
||||||
namespace Chill\PersonBundle\Entity;
|
namespace Chill\PersonBundle\Entity;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
use Symfony\Component\Validator\ExecutionContextInterface;
|
use Symfony\Component\Validator\ExecutionContextInterface;
|
||||||
use CL\CLHistoryBundle\Entity\IsHistoryContainer;
|
use Chill\MainBundle\Entity\Country;
|
||||||
use CL\CLHistoryBundle\Entity\HasHistory;
|
|
||||||
use CL\CLHistoryBundle\Entity\HistoryHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Person
|
* Person
|
||||||
*/
|
*/
|
||||||
class Person implements IsHistoryContainer, HasHistory {
|
class Person {
|
||||||
/**
|
/**
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
@ -42,48 +39,14 @@ class Person implements IsHistoryContainer, HasHistory {
|
|||||||
*/
|
*/
|
||||||
private $genre;
|
private $genre;
|
||||||
|
|
||||||
const GENRE_MAN = 'MAN';
|
const GENRE_MAN = 'man';
|
||||||
const GENRE_WOMAN = 'WOM';
|
const GENRE_WOMAN = 'woman';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $civil_union = self::CIVIL_UNKNOW;
|
|
||||||
/*Célibataire
|
|
||||||
Marié(e)
|
|
||||||
Veuf – Veuve
|
|
||||||
Séparé(e)
|
|
||||||
Divorcé(e)
|
|
||||||
Cohabitant légal
|
|
||||||
Indéterminé
|
|
||||||
ou une valeur vide lorsque la donnée nest pas connue*/
|
|
||||||
const CIVIL_SINGLE = 'single';
|
|
||||||
const CIVIL_WIDOW = 'widow';
|
|
||||||
const CIVIL_SEPARATED = 'separated';
|
|
||||||
const CIVIL_DIVORCED = 'divorced';
|
|
||||||
const CIVIL_COHAB = 'cohab';
|
|
||||||
const CIVIL_UNKNOW = 'unknow';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var integer
|
|
||||||
*/
|
|
||||||
private $nbOfChild = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $belgian_national_number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $memo = '';
|
private $memo = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $address = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -112,17 +75,6 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
private $proxyHistoryOpenState = false;
|
private $proxyHistoryOpenState = false;
|
||||||
|
|
||||||
|
|
||||||
const HISTORY_DOMAIN = 'person';
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $historyId = null;
|
|
||||||
|
|
||||||
const ACTION_UPDATE = 'update';
|
|
||||||
const ACTION_CREATE = 'create';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function __construct(\DateTime $opening = null) {
|
public function __construct(\DateTime $opening = null) {
|
||||||
@ -134,9 +86,6 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
|
|
||||||
$this->open($opening);
|
$this->open($opening);
|
||||||
|
|
||||||
//create an helper with key "update", and set "creation" instead
|
|
||||||
$this->getHistoryHelper(self::ACTION_UPDATE)
|
|
||||||
->setAction(self::ACTION_CREATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -288,11 +237,7 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
*/
|
*/
|
||||||
public function setName($name)
|
public function setName($name)
|
||||||
{
|
{
|
||||||
if ($name !== $this->name) {
|
$this->name = $name;
|
||||||
$this->getHistoryHelper(self::ACTION_UPDATE)
|
|
||||||
->registerChange('name', $this->name, $name);
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -406,7 +351,7 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* return gender as a Numeric form.
|
* return gender as a Numeric form.
|
||||||
* Useful for translation :-)
|
* This is used for translations
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getGenreNumeric() {
|
public function getGenreNumeric() {
|
||||||
@ -416,83 +361,6 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set civil_union
|
|
||||||
*
|
|
||||||
* @param string $civilUnion
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function setCivilUnion($civilUnion)
|
|
||||||
{
|
|
||||||
if ($this->civil_union !== $civilUnion) {
|
|
||||||
$this->getHistoryHelper(self::ACTION_UPDATE)
|
|
||||||
->registerChange('civil_union', $this->civil_union, $civilUnion);
|
|
||||||
$this->civil_union = $civilUnion;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get civil_union
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCivilUnion()
|
|
||||||
{
|
|
||||||
return $this->civil_union;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set nbOfChild
|
|
||||||
*
|
|
||||||
* @param integer $nbOfChild
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function setNbOfChild($nbOfChild)
|
|
||||||
{
|
|
||||||
$this->nbOfChild = $nbOfChild;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get nbOfChild
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getNbOfChild()
|
|
||||||
{
|
|
||||||
return $this->nbOfChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set belgian_national_number
|
|
||||||
*
|
|
||||||
* @param string $belgianNationalNumber
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function setBelgianNationalNumber($belgianNationalNumber)
|
|
||||||
{
|
|
||||||
if ($belgianNationalNumber === null) {
|
|
||||||
$belgianNationalNumber = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->belgian_national_number = $belgianNationalNumber;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get belgian_national_number
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getBelgianNationalNumber()
|
|
||||||
{
|
|
||||||
return $this->belgian_national_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set memo
|
* Set memo
|
||||||
*
|
*
|
||||||
@ -527,33 +395,6 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
return $this->memo;
|
return $this->memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set address
|
|
||||||
*
|
|
||||||
* @param string $address
|
|
||||||
* @return Person
|
|
||||||
*/
|
|
||||||
public function setAddress($address)
|
|
||||||
{
|
|
||||||
if ($address === null) {
|
|
||||||
$address = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->address = $address;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get address
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getAddress()
|
|
||||||
{
|
|
||||||
return $this->address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set email
|
* Set email
|
||||||
*
|
*
|
||||||
@ -584,28 +425,19 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
/**
|
/**
|
||||||
* Set countryOfBirth
|
* Set countryOfBirth
|
||||||
*
|
*
|
||||||
* @param \CL\Chill\MainBundle\Entity\Country $countryOfBirth
|
* @param Chill\MainBundle\Entity\Country $countryOfBirth
|
||||||
* @return Person
|
* @return Person
|
||||||
*/
|
*/
|
||||||
public function setCountryOfBirth(\CL\Chill\MainBundle\Entity\Country $countryOfBirth = null)
|
public function setCountryOfBirth(Country $countryOfBirth = null)
|
||||||
{
|
{
|
||||||
if ($this->countryOfBirth->getId() !== $countryOfBirth->getId()) {
|
$this->countryOfBirth = $countryOfBirth;
|
||||||
$this->getHistoryHelper(self::ACTION_UPDATE)
|
|
||||||
->registerChange('country_of_birth',
|
|
||||||
$this->countryOfBirth->getLabel(),
|
|
||||||
$countryOfBirth->getLabel());
|
|
||||||
|
|
||||||
$this->countryOfBirth = $countryOfBirth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get countryOfBirth
|
* Get countryOfBirth
|
||||||
*
|
*
|
||||||
* @return \CL\Chill\MainBundle\Entity\Country
|
* @return Chill\MainBundle\Entity\Country
|
||||||
*/
|
*/
|
||||||
public function getCountryOfBirth()
|
public function getCountryOfBirth()
|
||||||
{
|
{
|
||||||
@ -615,10 +447,10 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
/**
|
/**
|
||||||
* Set nationality
|
* Set nationality
|
||||||
*
|
*
|
||||||
* @param \CL\Chill\MainBundle\Entity\Country $nationality
|
* @param Chill\MainBundle\Entity\Country $nationality
|
||||||
* @return Person
|
* @return Person
|
||||||
*/
|
*/
|
||||||
public function setNationality(\CL\Chill\MainBundle\Entity\Country $nationality = null)
|
public function setNationality(Country $nationality = null)
|
||||||
{
|
{
|
||||||
$this->nationality = $nationality;
|
$this->nationality = $nationality;
|
||||||
|
|
||||||
@ -628,7 +460,7 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
/**
|
/**
|
||||||
* Get nationality
|
* Get nationality
|
||||||
*
|
*
|
||||||
* @return \CL\Chill\MainBundle\Entity\Country
|
* @return Chill\MainBundle\Entity\Country
|
||||||
*/
|
*/
|
||||||
public function getNationality()
|
public function getNationality()
|
||||||
{
|
{
|
||||||
@ -756,56 +588,4 @@ ou une valeur vide lorsque la donnée nest pas connue*/
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDomain() {
|
|
||||||
return self::HISTORY_DOMAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHistoryId() {
|
|
||||||
return $this->historyId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setHistoryId($id) {
|
|
||||||
$this->historyId = $id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \CL\CLHistoryBundle\Entity\HistoryHelper
|
|
||||||
*/
|
|
||||||
private $historyHelper = array();
|
|
||||||
|
|
||||||
|
|
||||||
private function getHistoryHelper($helper) {
|
|
||||||
if (!isset($this->historyHelper[$helper])) {
|
|
||||||
$this->historyHelper[$helper] = new HistoryHelper();
|
|
||||||
|
|
||||||
$this->historyHelper[$helper]->setAction($helper);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->historyHelper[$helper];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getEntityName() {
|
|
||||||
return 'person';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHistory() {
|
|
||||||
$histories = array();
|
|
||||||
|
|
||||||
foreach ($this->historyHelper as $historyHelper) {
|
|
||||||
$histories = $histories->toArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $histories;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getParentContainers() {
|
|
||||||
return array($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getVersion() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -25,38 +25,22 @@ Chill\PersonBundle\Entity\Person:
|
|||||||
default: ''
|
default: ''
|
||||||
genre:
|
genre:
|
||||||
type: string
|
type: string
|
||||||
length: 3
|
length: 9
|
||||||
civil_union:
|
|
||||||
type: string
|
|
||||||
length: 30
|
|
||||||
nullable: true
|
|
||||||
nbOfChild:
|
|
||||||
type: smallint
|
|
||||||
nullable: true
|
|
||||||
belgian_national_number:
|
|
||||||
type: string
|
|
||||||
length: 16
|
|
||||||
nullable: true
|
|
||||||
memo:
|
memo:
|
||||||
type: text
|
type: text
|
||||||
default: ''
|
default: ''
|
||||||
address:
|
|
||||||
type: text
|
|
||||||
email:
|
email:
|
||||||
type: text
|
type: text
|
||||||
proxyHistoryOpenState:
|
proxyHistoryOpenState:
|
||||||
type: boolean
|
type: boolean
|
||||||
name: proxy_open
|
name: proxy_open
|
||||||
historyId:
|
|
||||||
type: string
|
|
||||||
length: 40
|
|
||||||
manyToOne:
|
manyToOne:
|
||||||
countryOfBirth:
|
countryOfBirth:
|
||||||
targetEntity: CL\Chill\MainBundle\Entity\Country
|
targetEntity: Chill\MainBundle\Entity\Country
|
||||||
inversedBy: birthsIn
|
inversedBy: birthsIn
|
||||||
nullable: true
|
nullable: true
|
||||||
nationality:
|
nationality:
|
||||||
targetEntity: CL\Chill\MainBundle\Entity\Country
|
targetEntity: Chill\MainBundle\Entity\Country
|
||||||
inversedBy: nationals
|
inversedBy: nationals
|
||||||
nullable: true
|
nullable: true
|
||||||
oneToMany:
|
oneToMany:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user