src/Entity/Poste.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PosteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=PosteRepository::class)
  11.  */
  12. class Poste extends EntityBase
  13. {
  14.     /**
  15.      * @Groups("api")
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=PosteDirector::class, inversedBy="postes")
  23.      * @ORM\JoinColumn(nullable=false)
  24.      * @Assert\NotBlank(groups="creationPoste")
  25.      */
  26.     private $posteDirector;
  27.     /**
  28.      * @Groups("api")
  29.      * @ORM\ManyToOne(targetEntity=Employee::class)
  30.      * @ORM\JoinColumn(nullable=false)
  31.      * @Assert\NotBlank(groups="creationPoste")
  32.      */
  33.     private $responsable;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Localite::class, inversedBy="postes")
  36.      * @ORM\JoinColumn(nullable=false)
  37.      * @Assert\NotBlank(groups="creationPoste")
  38.      */
  39.     private $localite;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=Vacation::class, mappedBy="poste")
  42.      */
  43.     private $vacations;
  44.     /**
  45.      * @Groups("api")
  46.      * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class)
  47.      * @ORM\JoinColumn(nullable=false)
  48.      * @Assert\NotBlank(groups="creationPoste")
  49.      */
  50.     private $type;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=Device::class, mappedBy="poste")
  53.      */
  54.     private $devices;
  55.     /**
  56.      * @Groups("api")
  57.      * @ORM\OneToMany(targetEntity=PosteConfig::class, mappedBy="poste", orphanRemoval=true,cascade={"persist"})
  58.      * @ORM\OrderBy({"ordre" = "ASC"})
  59.      */
  60.     private $posteConfigs;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=DemandeVacation::class, mappedBy="poste")
  63.      */
  64.     private $demandeVacations;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private $telephone;
  69.     public function __construct()
  70.     {
  71.         $this->vacations = new ArrayCollection();
  72.         $this->devices = new ArrayCollection();
  73.         $this->posteConfigs = new ArrayCollection();
  74.         $this->demandeVacations = new ArrayCollection();
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getPosteDirector(): ?PosteDirector
  81.     {
  82.         return $this->posteDirector;
  83.     }
  84.     public function setPosteDirector(?PosteDirector $posteDirector): self
  85.     {
  86.         $this->posteDirector $posteDirector;
  87.         return $this;
  88.     }
  89.     public function getResponsable(): ?Employee
  90.     {
  91.         return $this->responsable;
  92.     }
  93.     public function setResponsable(?Employee $responsable): self
  94.     {
  95.         $this->responsable $responsable;
  96.         return $this;
  97.     }
  98.     public function getLocalite(): ?Localite
  99.     {
  100.         return $this->localite;
  101.     }
  102.     public function setLocalite(?Localite $localite): self
  103.     {
  104.         $this->localite $localite;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, Vacation>
  109.      */
  110.     public function getVacations(): Collection
  111.     {
  112.         return $this->vacations;
  113.     }
  114.     public function addVacation(Vacation $vacation): self
  115.     {
  116.         if (!$this->vacations->contains($vacation)) {
  117.             $this->vacations[] = $vacation;
  118.             $vacation->setPoste($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeVacation(Vacation $vacation): self
  123.     {
  124.         if ($this->vacations->removeElement($vacation)) {
  125.             // set the owning side to null (unless already changed)
  126.             if ($vacation->getPoste() === $this) {
  127.                 $vacation->setPoste(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132.     public function getType(): ?ResListeDeChoix
  133.     {
  134.         return $this->type;
  135.     }
  136.     public function setType(?ResListeDeChoix $type): self
  137.     {
  138.         $this->type $type;
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection<int, Device>
  143.      */
  144.     public function getDevices(): Collection
  145.     {
  146.         return $this->devices;
  147.     }
  148.     public function addDevice(Device $device): self
  149.     {
  150.         if (!$this->devices->contains($device)) {
  151.             $this->devices[] = $device;
  152.             $device->setPoste($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeDevice(Device $device): self
  157.     {
  158.         if ($this->devices->removeElement($device)) {
  159.             // set the owning side to null (unless already changed)
  160.             if ($device->getPoste() === $this) {
  161.                 $device->setPoste(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection<int, PosteConfig>
  168.      */
  169.     public function getPosteConfigs(): Collection
  170.     {
  171.         return $this->posteConfigs;
  172.     }
  173.     public function addPosteConfig(PosteConfig $posteConfig): self
  174.     {
  175.         if (!$this->posteConfigs->contains($posteConfig)) {
  176.             $this->posteConfigs[] = $posteConfig;
  177.             $posteConfig->setPoste($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removePosteConfig(PosteConfig $posteConfig): self
  182.     {
  183.         if ($this->posteConfigs->removeElement($posteConfig)) {
  184.             // set the owning side to null (unless already changed)
  185.             if ($posteConfig->getPoste() === $this) {
  186.                 $posteConfig->setPoste(null);
  187.             }
  188.         }
  189.         return $this;
  190.     }
  191.     /**
  192.      * @return Collection<int, DemandeVacation>
  193.      */
  194.     public function getDemandeVacations(): Collection
  195.     {
  196.         return $this->demandeVacations;
  197.     }
  198.     public function addDemandeVacation(DemandeVacation $demandeVacation): self
  199.     {
  200.         if (!$this->demandeVacations->contains($demandeVacation)) {
  201.             $this->demandeVacations[] = $demandeVacation;
  202.             $demandeVacation->setPoste($this);
  203.         }
  204.         return $this;
  205.     }
  206.     public function removeDemandeVacation(DemandeVacation $demandeVacation): self
  207.     {
  208.         if ($this->demandeVacations->removeElement($demandeVacation)) {
  209.             // set the owning side to null (unless already changed)
  210.             if ($demandeVacation->getPoste() === $this) {
  211.                 $demandeVacation->setPoste(null);
  212.             }
  213.         }
  214.         return $this;
  215.     }
  216.     public function getTelephone(): ?string
  217.     {
  218.         return $this->telephone;
  219.     }
  220.     public function setTelephone(string $telephone): self
  221.     {
  222.         $this->telephone $telephone;
  223.         return $this;
  224.     }
  225. }