src/Entity/Employee.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EmployeeRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass=EmployeeRepository::class)
  9.  */
  10. class Employee extends EntityBase
  11. {
  12.     /**
  13.      * @Groups("api")
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\OneToOne(targetEntity=Partner::class, inversedBy="employee", cascade={"persist", "remove"})
  21.      * @ORM\JoinColumn(nullable=false)
  22.      */
  23.     private $partner;
  24.     /**
  25.      * @Groups("api")
  26.      * @ORM\Column(type="string", length=255)
  27.      * @Assert\NotBlank(groups="creationEmployee")
  28.      */
  29.     private $lastName;
  30.     /**
  31.      * @Groups("api")
  32.      * @ORM\Column(type="string", length=255)
  33.      * @Assert\NotBlank(groups="creationEmployee")
  34.      */
  35.     private $firstName;
  36.     /**
  37.      * @ORM\Column(type="string", length=255, nullable=true)
  38.      * @Assert\NotBlank(groups="creationEmployee")
  39.      */
  40.     private $personalPhone;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      * @Assert\NotBlank(groups="creationEmployee")
  44.      */
  45.     private $email;
  46.     /**
  47.      * @ORM\Column(type="string", length=255)
  48.      * @Assert\NotBlank(groups="creationEmployee")
  49.      */
  50.     private $sexe;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class)
  53.      * @ORM\JoinColumn(nullable=true)
  54.      * @Assert\NotBlank(groups="creationEmployee")
  55.      */
  56.     private $type;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=PosteDirector::class, inversedBy="employees")
  59.      */
  60.     private $posteDirector;
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getPartner(): ?Partner
  66.     {
  67.         return $this->partner;
  68.     }
  69.     public function setPartner(Partner $partner): self
  70.     {
  71.         $this->partner $partner;
  72.         return $this;
  73.     }
  74.     public function getLastName(): ?string
  75.     {
  76.         return $this->lastName;
  77.     }
  78.     public function setLastName(string $lastName): self
  79.     {
  80.         $this->lastName $lastName;
  81.         return $this;
  82.     }
  83.     public function getFirstName(): ?string
  84.     {
  85.         return $this->firstName;
  86.     }
  87.     public function setFirstName(string $firstName): self
  88.     {
  89.         $this->firstName $firstName;
  90.         return $this;
  91.     }
  92.     public function getPersonalPhone(): ?string
  93.     {
  94.         return $this->personalPhone;
  95.     }
  96.     public function setPersonalPhone(?string $personalPhone): self
  97.     {
  98.         $this->personalPhone $personalPhone;
  99.         return $this;
  100.     }
  101.     public function getEmail(): ?string
  102.     {
  103.         return $this->email;
  104.     }
  105.     public function setEmail(?string $email): self
  106.     {
  107.         $this->email $email;
  108.         return $this;
  109.     }
  110.     public function getSexe(): ?string
  111.     {
  112.         return $this->sexe;
  113.     }
  114.     public function setSexe(string $sexe): self
  115.     {
  116.         $this->sexe $sexe;
  117.         return $this;
  118.     }
  119.     public function getType(): ?ResListeDeChoix
  120.     {
  121.         return $this->type;
  122.     }
  123.     public function setType(?ResListeDeChoix $type): self
  124.     {
  125.         $this->type $type;
  126.         return $this;
  127.     }
  128.     public function getFullName()
  129.     {
  130.         return $this->firstName " " $this->lastName;
  131.     }
  132.     public function getPosteDirector(): ?PosteDirector
  133.     {
  134.         return $this->posteDirector;
  135.     }
  136.     public function setPosteDirector(?PosteDirector $posteDirector): self
  137.     {
  138.         $this->posteDirector $posteDirector;
  139.         return $this;
  140.     }
  141. }