src/Entity/UserDetail.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserDetailRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Validator\Constraints as Assert;
  6. #[ORM\Entity(repositoryClassUserDetailRepository::class)]
  7. class UserDetail
  8. {
  9.     const GENDER_MALE "user.gender.male";
  10.     const GENDER_FEMALE "user.gender.female";
  11.     const GENDER_OTHER "user.gender.other";
  12.     const STATUS_BACHLOR "user.status.bachlor";
  13.     const STATUS_MARRIED "user.status.married";
  14.     const STATUS_DIVORCED "user.status.divorced";
  15.     const STATUS_WIDOWER "user.status.widower";
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     private ?int $id null;
  20.     #[ORM\Column(length255nullabletrue)]
  21.     private ?string $birthdayPlace null;
  22.     #[ORM\OneToOne(mappedBy'detail'cascade: ['persist''remove'])]
  23.     private ?User $user null;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $provinceOrigin null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $territory null;
  28.     #[ORM\Column(length255nullabletrue)]
  29.     private ?string $nationality null;
  30.     #[ORM\Column(length255nullabletrue)]
  31.     #[Assert\Choice(callback: [self::class, 'getMaritalStatusList'])]
  32.     private ?string $maritalStatus null;
  33.     #[ORM\Column(length255nullabletrue)]
  34.     private ?string $sector null;
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $groupment null;
  37.     #[ORM\Column(length255nullabletrue)]
  38.     private ?string $studyLevel null;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     private ?string $studyDomain null;
  41.     #[ORM\Column(length255nullabletrue)]
  42.     private ?string $function null;
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $politicalGrouping null;
  45.     #[ORM\Column(nullabletrue)]
  46.     private ?\DateTimeImmutable $birthdayAt;
  47.     #[ORM\Column(length255options: ["default" => self::GENDER_MALE])]
  48.     #[Assert\Choice(callback: [self::class, 'getGenderList'])]
  49.     private ?string $gender self::GENDER_MALE;
  50.     public static function getGenderList(): array{
  51.         return [
  52.             => self::GENDER_MALE,
  53.             => self::GENDER_FEMALE,
  54.             => self::GENDER_OTHER,
  55.         ];
  56.     }
  57.     public static function  getMaritalStatusList(): array
  58.     {
  59.         return [
  60.             => self::STATUS_BACHLOR,
  61.             => self::STATUS_MARRIED,
  62.             => self::STATUS_DIVORCED,
  63.             => self::STATUS_WIDOWER,
  64.         ];
  65.     }
  66.     public function __construct()
  67.     {
  68.         $this->birthdayAt = new \DateTimeImmutable("01-01-2000");
  69.     }
  70.     public function getId(): ?int
  71.     {
  72.         return $this->id;
  73.     }
  74.     public function getBirthdayPlace(): ?string
  75.     {
  76.         return $this->birthdayPlace;
  77.     }
  78.     public function setBirthdayPlace(?string $birthdayPlace): static
  79.     {
  80.         $this->birthdayPlace $birthdayPlace;
  81.         return $this;
  82.     }
  83.     public function getUser(): ?User
  84.     {
  85.         return $this->user;
  86.     }
  87.     public function setUser(?User $user): static
  88.     {
  89.         // unset the owning side of the relation if necessary
  90.         if ($user === null && $this->user !== null) {
  91.             $this->user->setDetail(null);
  92.         }
  93.         // set the owning side of the relation if necessary
  94.         if ($user !== null && $user->getDetail() !== $this) {
  95.             $user->setDetail($this);
  96.         }
  97.         $this->user $user;
  98.         return $this;
  99.     }
  100.     public function getProvinceOrigin(): ?string
  101.     {
  102.         return $this->provinceOrigin;
  103.     }
  104.     public function setProvinceOrigin(?string $provinceOrigin): static
  105.     {
  106.         $this->provinceOrigin $provinceOrigin;
  107.         return $this;
  108.     }
  109.     public function getTerritory(): ?string
  110.     {
  111.         return $this->territory;
  112.     }
  113.     public function setTerritory(?string $territory): static
  114.     {
  115.         $this->territory $territory;
  116.         return $this;
  117.     }
  118.     public function getNationality(): ?string
  119.     {
  120.         return $this->nationality;
  121.     }
  122.     public function setNationality(?string $nationality): static
  123.     {
  124.         $this->nationality $nationality;
  125.         return $this;
  126.     }
  127.     public function getMaritalStatus(): ?string
  128.     {
  129.         return $this->maritalStatus;
  130.     }
  131.     public function setMaritalStatus(?string $maritalStatus): static
  132.     {
  133.         $this->maritalStatus $maritalStatus;
  134.         return $this;
  135.     }
  136.     public function getSector(): ?string
  137.     {
  138.         return $this->sector;
  139.     }
  140.     public function setSector(?string $sector): static
  141.     {
  142.         $this->sector $sector;
  143.         return $this;
  144.     }
  145.     public function getGroupment(): ?string
  146.     {
  147.         return $this->groupment;
  148.     }
  149.     public function setGroupment(string $groupment): static
  150.     {
  151.         $this->groupment $groupment;
  152.         return $this;
  153.     }
  154.     public function getStudyLevel(): ?string
  155.     {
  156.         return $this->studyLevel;
  157.     }
  158.     public function setStudyLevel(?string $studyLevel): static
  159.     {
  160.         $this->studyLevel $studyLevel;
  161.         return $this;
  162.     }
  163.     public function getStudyDomain(): ?string
  164.     {
  165.         return $this->studyDomain;
  166.     }
  167.     public function setStudyDomain(?string $studyDomain): static
  168.     {
  169.         $this->studyDomain $studyDomain;
  170.         return $this;
  171.     }
  172.     public function getFunction(): ?string
  173.     {
  174.         return $this->function;
  175.     }
  176.     public function setFunction(?string $function): static
  177.     {
  178.         $this->function $function;
  179.         return $this;
  180.     }
  181.     public function getPoliticalGrouping(): ?string
  182.     {
  183.         return $this->politicalGrouping;
  184.     }
  185.     public function setPoliticalGrouping(?string $politicalGrouping): static
  186.     {
  187.         $this->politicalGrouping $politicalGrouping;
  188.         return $this;
  189.     }
  190.     public function getBirthdayAt(): ?\DateTimeImmutable
  191.     {
  192.         return $this->birthdayAt;
  193.     }
  194.     public function setBirthdayAt(?\DateTimeImmutable $birthdayAt): static
  195.     {
  196.         $this->birthdayAt $birthdayAt;
  197.         return $this;
  198.     }
  199.     public function getGender(): ?string
  200.     {
  201.         return $this->gender;
  202.     }
  203.     public function setGender(?string $gender): static
  204.     {
  205.         $this->gender $gender;
  206.         return $this;
  207.     }
  208. }