From 3ec43450b316cf5a5fbce80b21142bf24bede9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Sat, 26 Oct 2013 13:19:54 +0200 Subject: [PATCH] Add Initial Person --- DataFixtures/ORM/LoadPeople.php | 67 ++++ Entity/Person.php | 408 +++++++++++++++++++++++ Entity/PersonRepository.php | 15 + Resources/config/doctrine/Person.orm.yml | 57 ++++ 4 files changed, 547 insertions(+) create mode 100644 DataFixtures/ORM/LoadPeople.php create mode 100644 Entity/Person.php create mode 100644 Entity/PersonRepository.php create mode 100644 Resources/config/doctrine/Person.orm.yml diff --git a/DataFixtures/ORM/LoadPeople.php b/DataFixtures/ORM/LoadPeople.php new file mode 100644 index 000000000..786f3bb07 --- /dev/null +++ b/DataFixtures/ORM/LoadPeople.php @@ -0,0 +1,67 @@ + + */ +class LoadPeople extends AbstractFixture { + + public function getOrder() { + return 1001; + } + + + + public function load(ObjectManager $manager) { + foreach ($this->peoples as $person) { + $p = new Person(); + + foreach ($person as $key => $value) { + switch ($key) { + case 'CountryOfBirth': + break; + case 'Nationality': + break; + case 'DateOfBirth': + $value = new \DateTime($value); + + + default: + call_user_func(array($p, 'set'.$key), $value); + } + } + var_dump($p); + $manager->persist($p); + } + + $manager->flush(); + } + + private $peoples = array( + array( + 'Name' => "Depardieu", + 'Surname' => "Jean", + 'DateOfBirth' => "1960-10-12", + 'PlaceOfBirth' => "Ottignies Louvain-La-Neuve", + 'Genre' => Person::GENRE_MAN, + 'CivilUnion' => Person::CIVIL_DIVORCED, + 'NbOfChild' => 0, + 'BelgianNationalNumber' => '12-10-16-269-24', + 'Email' => "Email d'un ami: roger@tt.com", + 'CountryOfBirth' => 'France', + 'Nationality' => 'Russie' + + + ) + ); + + +} diff --git a/Entity/Person.php b/Entity/Person.php new file mode 100644 index 000000000..9256ee384 --- /dev/null +++ b/Entity/Person.php @@ -0,0 +1,408 @@ +id; + } + + /** + * Set name + * + * @param string $name + * @return Person + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set surname + * + * @param string $surname + * @return Person + */ + public function setSurname($surname) + { + $this->surname = $surname; + + return $this; + } + + /** + * Get surname + * + * @return string + */ + public function getSurname() + { + return $this->surname; + } + + /** + * Set dateOfBirth + * + * @param \DateTime $dateOfBirth + * @return Person + */ + public function setDateOfBirth($dateOfBirth) + { + $this->dateOfBirth = $dateOfBirth; + + return $this; + } + + /** + * Get dateOfBirth + * + * @return \DateTime + */ + public function getDateOfBirth() + { + return $this->dateOfBirth; + } + + + /** + * Set placeOfBirth + * + * @param string $placeOfBirth + * @return Person + */ + public function setPlaceOfBirth($placeOfBirth) + { + $this->placeOfBirth = $placeOfBirth; + + return $this; + } + + /** + * Get placeOfBirth + * + * @return string + */ + public function getPlaceOfBirth() + { + return $this->placeOfBirth; + } + + /** + * Set genre + * + * @param string $genre + * @return Person + */ + public function setGenre($genre) + { + $this->genre = $genre; + + return $this; + } + + /** + * Get genre + * + * @return string + */ + public function getGenre() + { + return $this->genre; + } + + /** + * Set civil_union + * + * @param string $civilUnion + * @return Person + */ + public function setCivilUnion($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) + { + $this->belgian_national_number = $belgianNationalNumber; + + return $this; + } + + /** + * Get belgian_national_number + * + * @return string + */ + public function getBelgianNationalNumber() + { + return $this->belgian_national_number; + } + + /** + * Set memo + * + * @param string $memo + * @return Person + */ + public function setMemo($memo) + { + $this->memo = $memo; + + return $this; + } + + /** + * Get memo + * + * @return string + */ + public function getMemo() + { + return $this->memo; + } + + /** + * Set address + * + * @param string $address + * @return Person + */ + public function setAddress($address) + { + $this->address = $address; + + return $this; + } + + /** + * Get address + * + * @return string + */ + public function getAddress() + { + return $this->address; + } + + /** + * Set email + * + * @param string $email + * @return Person + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * Set countryOfBirth + * + * @param \CL\Chill\MainBundle\Entity\Country $countryOfBirth + * @return Person + */ + public function setCountryOfBirth(\CL\Chill\MainBundle\Entity\Country $countryOfBirth = null) + { + $this->countryOfBirth = $countryOfBirth; + + return $this; + } + + /** + * Get countryOfBirth + * + * @return \CL\Chill\MainBundle\Entity\Country + */ + public function getCountryOfBirth() + { + return $this->countryOfBirth; + } + + /** + * Set nationality + * + * @param \CL\Chill\MainBundle\Entity\Country $nationality + * @return Person + */ + public function setNationality(\CL\Chill\MainBundle\Entity\Country $nationality = null) + { + $this->nationality = $nationality; + + return $this; + } + + /** + * Get nationality + * + * @return \CL\Chill\MainBundle\Entity\Country + */ + public function getNationality() + { + return $this->nationality; + } +} \ No newline at end of file diff --git a/Entity/PersonRepository.php b/Entity/PersonRepository.php new file mode 100644 index 000000000..b35740c72 --- /dev/null +++ b/Entity/PersonRepository.php @@ -0,0 +1,15 @@ +