src/Entity/WebMapPopupTemplate.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WebMapPopupTemplateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=WebMapPopupTemplateRepository::class)
  9.  */
  10. class WebMapPopupTemplate
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.      /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $gabaritName;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $thumbnail;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $preview;
  34.     /**
  35.      * @ORM\Column(type="json", nullable=true)
  36.      */
  37.     private $parameters;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=WebMap::class, mappedBy="popupTemplate")
  40.      */
  41.     private $webMaps;
  42.     public function __construct()
  43.     {
  44.         $this->webMaps = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getName(): ?string
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     public function getGabaritName(): ?string
  60.     {
  61.         return $this->gabaritName;
  62.     }
  63.     public function setGabaritName(?string $gabaritName): self
  64.     {
  65.         $this->gabaritName $gabaritName;
  66.         return $this;
  67.     }
  68.     public function getThumbnail(): ?string
  69.     {
  70.         return $this->thumbnail;
  71.     }
  72.     public function setThumbnail(?string $thumbnail): self
  73.     {
  74.         $this->thumbnail $thumbnail;
  75.         return $this;
  76.     }
  77.     public function getPreview(): ?string
  78.     {
  79.         return $this->preview;
  80.     }
  81.     public function setPreview(?string $preview): self
  82.     {
  83.         $this->preview $preview;
  84.         return $this;
  85.     }
  86.     public function getParameters(): ?array
  87.     {
  88.         return $this->parameters;
  89.     }
  90.     public function setParameters(?array $parameters): self
  91.     {
  92.         $this->parameters $parameters;
  93.         return $this;
  94.     }
  95.     /**
  96.      * @return Collection|WebMap[]
  97.      */
  98.     public function getWebMaps(): Collection
  99.     {
  100.         return $this->webMaps;
  101.     }
  102.     public function addWebMap(WebMap $webMap): self
  103.     {
  104.         if (!$this->webMaps->contains($webMap)) {
  105.             $this->webMaps[] = $webMap;
  106.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  107.             $webMap->setMapPopupTemplate($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeWebMap(WebMap $webMap): self
  112.     {
  113.         if ($this->webMaps->contains($webMap)) {
  114.             $this->webMaps->removeElement($webMap);
  115.             // passer l'autre côté à null pour éviter les incohérences
  116.             if ($webMap->getPopupTemplate() === $this) {
  117.                 $webMap->setPopupTemplate(null);
  118.             }
  119.         }
  120.         return $this;
  121.     }
  122. }