src/Entity/WebMap.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\WebMapRepository")
  8.  */
  9. class WebMap
  10. {
  11.     /**
  12.      * @ORM\Id()
  13.      * @ORM\GeneratedValue()
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="json", nullable=true)
  23.      */
  24.     private $parameters;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity="App\Entity\WebMapTemplate", inversedBy="webMaps")
  27.      * @ORM\JoinColumns({
  28.      *   @ORM\JoinColumn(name="map_template_id", referencedColumnName="id")
  29.      * })
  30.      */
  31.     private $mapTemplate;
  32.     /**
  33.      * @ORM\ManytoOne(targetEntity="App\Entity\WebMapPopupTemplate", inversedBy="webMaps")
  34.      * @ORM\JoinColumns({
  35.      *   @ORM\JoinColumn(name="popup_template_id", referencedColumnName="id")
  36.      * })
  37.      */
  38.     private $popupTemplate;
  39.     /**
  40.      * @ORM\Column(type="datetime", nullable=true)
  41.      */
  42.     private $createdAt;
  43.     /**
  44.      * @ORM\Column(type="datetime", nullable=true)
  45.      */
  46.     private $updatedAt;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true, options={"default":0, "comment":"code de statut : 0=OK"})
  49.      */
  50.     private $state;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="webMaps")
  53.      * @ORM\JoinColumns({
  54.      *   @ORM\JoinColumn(name="owner_id", referencedColumnName="id")
  55.      * })
  56.      */
  57.     private $owner;
  58.     /**
  59.      * @ORM\ManyToOne(targetEntity="App\Entity\DnsitEntity", inversedBy="webMaps")
  60.      * @ORM\JoinColumns({
  61.      *   @ORM\JoinColumn(name="entity_id", referencedColumnName="id")
  62.      * })
  63.      */
  64.     private $entity;
  65.     /**
  66.      * @ORM\ManyToMany(targetEntity="App\Entity\Tag", inversedBy="webMaps")
  67.      */
  68.     private $tags;
  69.     /**
  70.      * @var \Doctrine\Common\Collections\Collection
  71.      *
  72.      * @ORM\OneToMany(targetEntity="App\Entity\WebMapItem", mappedBy="webMap", cascade={"persist","remove"}, orphanRemoval=true)
  73.      * @ORM\OrderBy({"ordering" = "ASC"})
  74.      */
  75.     private $items;
  76.     /**
  77.      * @var \Doctrine\Common\Collections\Collection
  78.      *
  79.      * @ORM\OneToMany(targetEntity="App\Entity\WebMapPopupBlock", mappedBy="webMap", cascade={"persist","remove"})
  80.      */
  81.     private $popupBlocks;
  82.     /**
  83.      * Constructor
  84.      */
  85.     public function __construct()
  86.     {
  87.         $this->tags = new ArrayCollection();
  88.         $this->items = new ArrayCollection();
  89.         $this->popupBlocks = new ArrayCollection();
  90.     }
  91.     public function getId(): ?int
  92.     {
  93.         return $this->id;
  94.     }
  95.     public function getName(): ?string
  96.     {
  97.         return $this->name;
  98.     }
  99.     public function setName(?string $name): self
  100.     {
  101.         $this->name $name;
  102.         return $this;
  103.     }
  104.     public function getParameters(): ?array
  105.     {
  106.         return $this->parameters;
  107.     }
  108.     public function setParameters(?array $parameters): self
  109.     {
  110.         $this->parameters $parameters;
  111.         return $this;
  112.     }
  113.     public function getMapTemplate(): ?WebMapTemplate
  114.     {
  115.         return $this->mapTemplate;
  116.     }
  117.     public function setMapTemplate(?WebMapTemplate $mapTemplate): self
  118.     {
  119.         $this->mapTemplate $mapTemplate;
  120.         return $this;
  121.     }
  122.     public function getPopupTemplate(): ?WebMapPopupTemplate
  123.     {
  124.         return $this->popupTemplate;
  125.     }
  126.     public function setPopupTemplate(?WebMapPopupTemplate $popupTemplate): self
  127.     {
  128.         $this->popupTemplate $popupTemplate;
  129.         return $this;
  130.     }
  131.     public function getCreatedAt(): ?\DateTimeInterface
  132.     {
  133.         return $this->createdAt;
  134.     }
  135.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  136.     {
  137.         $this->createdAt $createdAt;
  138.         return $this;
  139.     }
  140.     public function getUpdatedAt(): ?\DateTimeInterface
  141.     {
  142.         return $this->updatedAt;
  143.     }
  144.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  145.     {
  146.         $this->updatedAt $updatedAt;
  147.         return $this;
  148.     }
  149.     public function getState(): ?int
  150.     {
  151.         return $this->state;
  152.     }
  153.     public function setState(?int $state): self
  154.     {
  155.         $this->state $state;
  156.         return $this;
  157.     }
  158.     public function getOwner(): ?User
  159.     {
  160.         return $this->owner;
  161.     }
  162.     public function setOwner(?User $owner): self
  163.     {
  164.         $this->owner $owner;
  165.         return $this;
  166.     }
  167.     public function getEntity(): ?DnsitEntity
  168.     {
  169.         return $this->entity;
  170.     }
  171.     public function setEntity(?DnsitEntity $entity): self
  172.     {
  173.         $this->entity $entity;
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return Collection|Tag[]
  178.      */
  179.     public function getTags(): Collection
  180.     {
  181.         return $this->tags;
  182.     }
  183.     public function addTag(Tag $tag): self
  184.     {
  185.         if (!$this->tags->contains($tag)) {
  186.             $this->tags[] = $tag;
  187.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  188.             $tag->addWebMap($this);
  189.         }
  190.         return $this;
  191.     }
  192.     public function removeTag(Tag $tag): self
  193.     {
  194.         if ($this->tags->contains($tag)) {
  195.             $this->tags->removeElement($tag);
  196.             // passer l'autre côté à null pour éviter les incohérences
  197.             if ($tag->getWebMaps() === $this) {
  198.                 $tag->setWebMap(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection|WebMapItem[]
  205.      */
  206.     public function getItems(): Collection
  207.     {
  208.         return $this->items;
  209.     }
  210.     public function addItem(WebMapItem $item): self
  211.     {
  212.         if (!$this->items->contains($item)) {
  213.             $this->items[] = $item;
  214.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  215.             $item->setWebMap($this);
  216.         }
  217.         return $this;
  218.     }
  219.     public function removeItem(WebMapItem $item): self
  220.     {
  221.         if ($this->items->contains($item)) {
  222.             $this->items->removeElement($item);
  223.             // passer l'autre côté à null pour éviter les incohérences
  224.             if ($item->getWebMap() === $this) {
  225.                 $item->setWebMap(null);
  226.             }
  227.         }
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return Collection|WebMapPopupBlocks[]
  232.      */
  233.     public function getPopupBlocks(): Collection
  234.     {
  235.         return $this->popupBlocks;
  236.     }
  237.     public function addPopupBlock(WebMapPopupBlock $popupBlock): self
  238.     {
  239.         if (!$this->popupBlocks->contains($popupBlock)) {
  240.             $this->popupBlocks[] = $popupBlock;
  241.             // ajouter aussi la relation correspondante de l'autre côté pour éviter les incohérences
  242.             $popupBlock->setWebMap($this);
  243.         }
  244.         return $this;
  245.     }
  246.     public function removePopupBlock(WebMapPopupBlock $popupBlock): self
  247.     {
  248.         if ($this->popupBlocks->contains($popupBlock)) {
  249.             $this->popupBlocks->removeElement($popupBlock);
  250.             // passer l'autre côté à null pour éviter les incohérences
  251.             if ($popupBlock->getWebMap() === $this) {
  252.                 $popupBlock->setWebMap(null);
  253.             }
  254.         }
  255.         return $this;
  256.     }
  257. }