src/Entity/Localite.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LocaliteRepository;
  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. use App\Validator as CustomAssert;
  10. /**
  11.  * @ORM\Entity(repositoryClass=LocaliteRepository::class)
  12.  */
  13. class Localite  extends EntityBase
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\OneToMany(targetEntity=Poste::class, mappedBy="localite")
  23.      */
  24.     private $postes;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=PosteDirector::class, mappedBy="localite")
  27.      */
  28.     private $posteDirectors;
  29.     /**
  30.      * @CustomAssert\Coordinates(groups={"creationLocalite"})
  31.      * @ORM\Column(type="text", nullable=true)
  32.      * @Assert\NotBlank(groups={"creationLocalite","Localite"})
  33.      */
  34.     private $coordinates;
  35.     /**
  36.      * @ORM\Column(type="boolean", nullable=true)
  37.      */
  38.     private $hasCoordinates;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class)
  41.      * @Assert\NotBlank(groups="Localite")
  42.      */
  43.     private $typeCoordinates;
  44.     /**
  45.      * @Groups("api")
  46.      * @ORM\ManyToOne(targetEntity=ResListeDeChoix::class)
  47.      * @ORM\JoinColumn(nullable=false)
  48.      * @Assert\NotBlank(groups="Localite")
  49.      */
  50.     private $type;
  51.     /**
  52.      * @ORM\Column(type="integer", nullable=true)
  53.      */
  54.     private $ordre;
  55.     public function __construct()
  56.     {
  57.         $this->postes = new ArrayCollection();
  58.         $this->posteDirectors = new ArrayCollection();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     /**
  65.      * @return Collection<int, Poste>
  66.      */
  67.     public function getPostes(): Collection
  68.     {
  69.         return $this->postes;
  70.     }
  71.     public function addPoste(Poste $poste): self
  72.     {
  73.         if (!$this->postes->contains($poste)) {
  74.             $this->postes[] = $poste;
  75.             $poste->setLocalite($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removePoste(Poste $poste): self
  80.     {
  81.         if ($this->postes->removeElement($poste)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($poste->getLocalite() === $this) {
  84.                 $poste->setLocalite(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, PosteDirector>
  91.      */
  92.     public function getPosteDirectors(): Collection
  93.     {
  94.         return $this->posteDirectors;
  95.     }
  96.     public function addPosteDirector(PosteDirector $posteDirector): self
  97.     {
  98.         if (!$this->posteDirectors->contains($posteDirector)) {
  99.             $this->posteDirectors[] = $posteDirector;
  100.             $posteDirector->setLocalite($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removePosteDirector(PosteDirector $posteDirector): self
  105.     {
  106.         if ($this->posteDirectors->removeElement($posteDirector)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($posteDirector->getLocalite() === $this) {
  109.                 $posteDirector->setLocalite(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getCoordinates(): ?string
  115.     {
  116.         return $this->coordinates;
  117.     }
  118.     public function setCoordinates(?string $coordinates): self
  119.     {
  120.         $this->coordinates $coordinates;
  121.         return $this;
  122.     }
  123.     public function isHasCoordinates(): ?bool
  124.     {
  125.         return $this->hasCoordinates;
  126.     }
  127.     public function setHasCoordinates(?bool $hasCoordinates): self
  128.     {
  129.         $this->hasCoordinates $hasCoordinates;
  130.         return $this;
  131.     }
  132.     public function getTypeCoordinates(): ?ResListeDeChoix
  133.     {
  134.         return $this->typeCoordinates;
  135.     }
  136.     public function setTypeCoordinates(?ResListeDeChoix $typeCoordinates): self
  137.     {
  138.         $this->typeCoordinates $typeCoordinates;
  139.         return $this;
  140.     }
  141.     public function getType(): ?ResListeDeChoix
  142.     {
  143.         return $this->type;
  144.     }
  145.     public function setType(?ResListeDeChoix $type): self
  146.     {
  147.         $this->type $type;
  148.         return $this;
  149.     }
  150.     public function getOrdre(): ?int
  151.     {
  152.         return $this->ordre;
  153.     }
  154.     public function setOrdre(?int $ordre): self
  155.     {
  156.         $this->ordre $ordre;
  157.         return $this;
  158.     }
  159. }