<?php
namespace App\Entity;
use App\Repository\WebListTemplateRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity (repositoryClass=WebListTemplateRepository::class)
*/
class WebListTemplate
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, unique=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $gabaritName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $specificCssPath;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $specificJsPath;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $thumbnail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $preview;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $templateType;
/**
* @ORM\ManyToMany(targetEntity=WebListTemplateTag::class, inversedBy="templates", cascade={"persist"})
*/
private $tags;
/**
* @ORM\OneToMany(targetEntity=WebList::class, mappedBy="listTemplate")
*/
private $webLists;
/**
* @ORM\OneToMany(targetEntity=ListModel::class, mappedBy="listTemplate")
*/
private $listModels;
public function __construct()
{
$this->tags = new ArrayCollection();
$this->webLists = new ArrayCollection();
$this->listModels = new ArrayCollection();
}
public function getId() : ?int
{
return $this->id;
}
public function getName() : string
{
return $this->name;
}
public function setName(string $name) : self
{
$this->name = $name;
return $this;
}
public function getGabaritName() : ?string
{
return $this->gabaritName;
}
public function setGabaritName(string $gabaritName) : self
{
$this->gabaritName = $gabaritName;
return $this;
}
public function getSpecificCssPath() : ?string
{
return $this->specificCssPath;
}
public function setSpecificCssPath(?string $specificCssPath) : self
{
$this->specificCssPath = $specificCssPath;
return $this;
}
public function getSpecificJsPath() : ?string
{
return $this->specificJsPath;
}
public function setSpecificJsPath(?string $specificJsPath) : self
{
$this->specificJsPath = $specificJsPath;
return $this;
}
public function getThumbnail() : ?string
{
return $this->thumbnail;
}
public function setThumbnail(?string $thumbnail) : self
{
$this->thumbnail = $thumbnail;
return $this;
}
public function getPreview() : ?string
{
return $this->preview;
}
public function setPreview(?string $preview) : self
{
$this->preview = $preview;
return $this;
}
/**
* @return Collection|WebListTemplateTag[]
*/
public function getTags() : Collection
{
return $this->tags;
}
public function addTag(WebListTemplateTag $tag) : self
{
if (!$this->tags->contains($tag)) {
$this->tags[] = $tag;
}
return $this;
}
public function removeTag(WebListTemplateTag $tag) : self
{
$this->tags->removeElement($tag);
return $this;
}
/**
* @return Collection|WebList[]
*/
public function getWebLists() : Collection
{
return $this->webLists;
}
public function addWebList(WebList $webList) : self
{
if (!$this->webLists->contains($webList)) {
$this->webLists[] = $webList;
$webList->setListTemplate($this);
}
return $this;
}
public function removeWebList(WebList $webList) : self
{
if ($this->webLists->removeElement($webList)) {
// set the owning side to null (unless already changed)
if ($webList->getListTemplate() === $this) {
$webList->setListTemplate(null);
}
}
return $this;
}
/**
* @return Collection|ListModel[]
*/
public function getListModels() : Collection
{
return $this->listModels;
}
public function addListModel(ListModel $listModel) : self
{
if (!$this->listModels->contains($listModel)) {
$this->listModels[] = $listModel;
$listModel->setListTemplate($this);
}
return $this;
}
public function removeListModel(ListModel $listModel) : self
{
if ($this->listModels->removeElement($listModel)) {
// set the owning side to null (unless already changed)
if ($listModel->getListTemplate() === $this) {
$listModel->setListTemplate(null);
}
}
return $this;
}
public function toExport() : array
{
$template = array();
$template['name'] = $this->getName();
$template['gabaritName'] = $this->getGabaritName();
$template['specificCssPath'] = $this->getSpecificCssPath();
$template['specificJsPath'] = $this->getSpecificJsPath();
$template['thumbnail'] = $this->getThumbnail();
$template['preview'] = $this->getPreview();
$template['templateType'] = $this->getTemplateType();
$template['tags'] = array();
foreach ($this->getTags() as $tag) {
$template['tags'][] = $tag->toExport();
}
return $template;
}
public function getTemplateType() : ?string
{
return $this->templateType;
}
public function setTemplateType(?string $templateType) : self
{
$this->templateType = $templateType;
return $this;
}
}