src/Entity/WebListTemplate.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\WebListTemplateRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity (repositoryClass=WebListTemplateRepository::class)
  9.  */
  10. class WebListTemplate
  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, unique=true)
  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 $specificCssPath;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $specificJsPath;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $thumbnail;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $preview;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $templateType;
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity=WebListTemplateTag::class, inversedBy="templates", cascade={"persist"})
  48.      */
  49.     private $tags;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity=WebList::class, mappedBy="listTemplate")
  52.      */
  53.     private $webLists;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=ListModel::class, mappedBy="listTemplate")
  56.      */
  57.     private $listModels;
  58.     public function __construct()
  59.     {
  60.         $this->tags = new ArrayCollection();
  61.         $this->webLists = new ArrayCollection();
  62.         $this->listModels = new ArrayCollection();
  63.     }
  64.     public function getId() : ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getName() : string
  69.     {
  70.         return $this->name;
  71.     }
  72.     public function setName(string $name) : self
  73.     {
  74.         $this->name $name;
  75.         return $this;
  76.     }
  77.     public function getGabaritName() : ?string
  78.     {
  79.         return $this->gabaritName;
  80.     }
  81.     public function setGabaritName(string $gabaritName) : self
  82.     {
  83.         $this->gabaritName $gabaritName;
  84.         return $this;
  85.     }
  86.     public function getSpecificCssPath() : ?string
  87.     {
  88.         return $this->specificCssPath;
  89.     }
  90.     public function setSpecificCssPath(?string $specificCssPath) : self
  91.     {
  92.         $this->specificCssPath $specificCssPath;
  93.         return $this;
  94.     }
  95.     public function getSpecificJsPath() : ?string
  96.     {
  97.         return $this->specificJsPath;
  98.     }
  99.     public function setSpecificJsPath(?string $specificJsPath) : self
  100.     {
  101.         $this->specificJsPath $specificJsPath;
  102.         return $this;
  103.     }
  104.     public function getThumbnail() : ?string
  105.     {
  106.         return $this->thumbnail;
  107.     }
  108.     public function setThumbnail(?string $thumbnail) : self
  109.     {
  110.         $this->thumbnail $thumbnail;
  111.         return $this;
  112.     }
  113.     public function getPreview() : ?string
  114.     {
  115.         return $this->preview;
  116.     }
  117.     public function setPreview(?string $preview) : self
  118.     {
  119.         $this->preview $preview;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection|WebListTemplateTag[]
  124.      */
  125.     public function getTags() : Collection
  126.     {
  127.         return $this->tags;
  128.     }
  129.     public function addTag(WebListTemplateTag $tag) : self
  130.     {
  131.         if (!$this->tags->contains($tag)) {
  132.             $this->tags[] = $tag;
  133.         }
  134.         return $this;
  135.     }
  136.     public function removeTag(WebListTemplateTag $tag) : self
  137.     {
  138.         $this->tags->removeElement($tag);
  139.         return $this;
  140.     }
  141.     /**
  142.      * @return Collection|WebList[]
  143.      */
  144.     public function getWebLists() : Collection
  145.     {
  146.         return $this->webLists;
  147.     }
  148.     public function addWebList(WebList $webList) : self
  149.     {
  150.         if (!$this->webLists->contains($webList)) {
  151.             $this->webLists[] = $webList;
  152.             $webList->setListTemplate($this);
  153.         }
  154.         return $this;
  155.     }
  156.     public function removeWebList(WebList $webList) : self
  157.     {
  158.         if ($this->webLists->removeElement($webList)) {
  159.             // set the owning side to null (unless already changed)
  160.             if ($webList->getListTemplate() === $this) {
  161.                 $webList->setListTemplate(null);
  162.             }
  163.         }
  164.         return $this;
  165.     }
  166.     /**
  167.      * @return Collection|ListModel[]
  168.      */
  169.     public function getListModels() : Collection
  170.     {
  171.         return $this->listModels;
  172.     }
  173.     public function addListModel(ListModel $listModel) : self
  174.     {
  175.         if (!$this->listModels->contains($listModel)) {
  176.             $this->listModels[] = $listModel;
  177.             $listModel->setListTemplate($this);
  178.         }
  179.         return $this;
  180.     }
  181.     public function removeListModel(ListModel $listModel) : self
  182.     {
  183.         if ($this->listModels->removeElement($listModel)) {
  184.             // set the owning side to null (unless already changed)
  185.             if ($listModel->getListTemplate() === $this) {
  186.                 $listModel->setListTemplate(null);
  187.             }
  188.         }
  189.         return $this;
  190.     }
  191.     public function toExport() : array
  192.     {
  193.         $template = array();
  194.         $template['name'] = $this->getName();
  195.         $template['gabaritName'] = $this->getGabaritName();
  196.         $template['specificCssPath'] = $this->getSpecificCssPath();
  197.         $template['specificJsPath'] = $this->getSpecificJsPath();
  198.         $template['thumbnail'] = $this->getThumbnail();
  199.         $template['preview'] = $this->getPreview();
  200.         $template['templateType'] = $this->getTemplateType();
  201.         $template['tags'] = array();
  202.         foreach ($this->getTags() as $tag) {
  203.             $template['tags'][] = $tag->toExport();
  204.         }
  205.         return $template;
  206.     }
  207.     public function getTemplateType() : ?string
  208.     {
  209.         return $this->templateType;
  210.     }
  211.     public function setTemplateType(?string $templateType) : self
  212.     {
  213.         $this->templateType $templateType;
  214.         return $this;
  215.     }
  216. }