<?php
namespace App\Entity\Gos\Tmpl;
use App\Entity\Gos\Category;
use App\Entity\Gos\PortalSettings;
use App\Entity\Gos\Product;
use App\Entity\Gos\ProductAssociation;
use App\Entity\Gos\ProductMainType;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\TemplateRepository")
* @ORM\Table(name="templates")
* @ORM\HasLifecycleCallbacks
*/
class Template
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var boolean
* @ORM\Column(name="is_active", type="boolean", nullable=false, options={"default": 1})
*/
private $isActive;
/**
* @var string
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="templates")
*/
private $portalSettings;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Gos\Tmpl\TmplItem",
* mappedBy="template",
* orphanRemoval=true,
* cascade={"persist", "remove"})
* @ORM\OrderBy({"position" = "ASC"})
*/
private $tmplItems;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\Category", inversedBy="template", cascade={"persist"})
*/
private $category;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\ProductAssociation", inversedBy="template", cascade={"persist"})
*/
private $productAssociation;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Gos\ProductMainType", inversedBy="template", cascade={"persist"})
*/
private $productMainType;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\Tmpl\TemplateType", inversedBy="templates")
* @ORM\JoinColumn(nullable=true)
*/
private $templateType;
public function __construct()
{
$this->tmplItems = new ArrayCollection();
}
public function __toString()
{
return $this->getTemplateType()->getName();
}
public function getId(): ?int
{
return $this->id;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getPortalSettings(): ?PortalSettings
{
return $this->portalSettings;
}
public function setPortalSettings(?PortalSettings $portalSettings): self
{
$this->portalSettings = $portalSettings;
return $this;
}
/**
* @return Collection|TmplItem[]
*/
public function getTmplItems(): Collection
{
return $this->tmplItems;
}
public function addTmplItem(TmplItem $tmplItem): self
{
if (!$this->tmplItems->contains($tmplItem))
{
$this->tmplItems[] = $tmplItem;
$tmplItem->setTemplate($this);
}
return $this;
}
public function removeTmplItem(TmplItem $tmplItem): self
{
if ($this->tmplItems->contains($tmplItem))
{
$this->tmplItems->removeElement($tmplItem);
// set the owning side to null (unless already changed)
if ($tmplItem->getTemplate() === $this)
{
$tmplItem->setTemplate(null);
}
}
return $this;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
public function getProductMainType(): ?ProductMainType
{
return $this->productMainType;
}
public function setProductMainType(?ProductMainType $productMainType): self
{
$this->productMainType = $productMainType;
return $this;
}
public function getTemplateType(): ?TemplateType
{
return $this->templateType;
}
public function setTemplateType(?TemplateType $templateType): self
{
$this->templateType = $templateType;
return $this;
}
public function getProductAssociation(): ?ProductAssociation
{
return $this->productAssociation;
}
public function setProductAssociation(?ProductAssociation $productAssociation): self
{
$this->productAssociation = $productAssociation;
return $this;
}
}