src/Entity/Gos/Tmpl/Template.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos\Tmpl;
  3. use App\Entity\Gos\Category;
  4. use App\Entity\Gos\PortalSettings;
  5. use App\Entity\Gos\Product;
  6. use App\Entity\Gos\ProductAssociation;
  7. use App\Entity\Gos\ProductMainType;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * @ORM\Entity(repositoryClass="App\Repository\TemplateRepository")
  13.  * @ORM\Table(name="templates")
  14.  * @ORM\HasLifecycleCallbacks
  15.  */
  16. class Template
  17. {
  18.     /**
  19.      * @var int
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var boolean
  28.      * @ORM\Column(name="is_active", type="boolean", nullable=false, options={"default": 1})
  29.      */
  30.     private $isActive;
  31.     /**
  32.      * @var string
  33.      * @ORM\Column(name="name", type="string", length=255)
  34.      */
  35.     private $name;
  36.     /**
  37.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\PortalSettings", inversedBy="templates")
  38.      */
  39.     private $portalSettings;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity="App\Entity\Gos\Tmpl\TmplItem",
  42.      *     mappedBy="template",
  43.      *     orphanRemoval=true, 
  44.      *     cascade={"persist", "remove"})
  45.      * @ORM\OrderBy({"position" = "ASC"})
  46.      */
  47.     private $tmplItems;
  48.     /**
  49.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\Category", inversedBy="template", cascade={"persist"})
  50.      */
  51.     private $category;
  52.     /**
  53.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\ProductAssociation", inversedBy="template", cascade={"persist"})
  54.      */
  55.     private $productAssociation;
  56.     /**
  57.      * @ORM\OneToOne(targetEntity="App\Entity\Gos\ProductMainType", inversedBy="template", cascade={"persist"})
  58.      */
  59.     private $productMainType;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\Tmpl\TemplateType", inversedBy="templates")
  62.      * @ORM\JoinColumn(nullable=true)
  63.      */
  64.     private $templateType;
  65.     public function __construct()
  66.     {
  67.         $this->tmplItems = new ArrayCollection();
  68.     }
  69.     public function __toString()
  70.     {
  71.         return $this->getTemplateType()->getName();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getIsActive(): ?bool
  78.     {
  79.         return $this->isActive;
  80.     }
  81.     public function setIsActive(bool $isActive): self
  82.     {
  83.         $this->isActive $isActive;
  84.         return $this;
  85.     }
  86.     public function getName(): ?string
  87.     {
  88.         return $this->name;
  89.     }
  90.     public function setName(string $name): self
  91.     {
  92.         $this->name $name;
  93.         return $this;
  94.     }
  95.     public function getPortalSettings(): ?PortalSettings
  96.     {
  97.         return $this->portalSettings;
  98.     }
  99.     public function setPortalSettings(?PortalSettings $portalSettings): self
  100.     {
  101.         $this->portalSettings $portalSettings;
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection|TmplItem[]
  106.      */
  107.     public function getTmplItems(): Collection
  108.     {
  109.         return $this->tmplItems;
  110.     }
  111.     public function addTmplItem(TmplItem $tmplItem): self
  112.     {
  113.         if (!$this->tmplItems->contains($tmplItem))
  114.         {
  115.             $this->tmplItems[] = $tmplItem;
  116.             $tmplItem->setTemplate($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeTmplItem(TmplItem $tmplItem): self
  121.     {
  122.         if ($this->tmplItems->contains($tmplItem))
  123.         {
  124.             $this->tmplItems->removeElement($tmplItem);
  125.             // set the owning side to null (unless already changed)
  126.             if ($tmplItem->getTemplate() === $this)
  127.             {
  128.                 $tmplItem->setTemplate(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133.     public function getCategory(): ?Category
  134.     {
  135.         return $this->category;
  136.     }
  137.     public function setCategory(?Category $category): self
  138.     {
  139.         $this->category $category;
  140.         return $this;
  141.     }
  142.     public function getProductMainType(): ?ProductMainType
  143.     {
  144.         return $this->productMainType;
  145.     }
  146.     public function setProductMainType(?ProductMainType $productMainType): self
  147.     {
  148.         $this->productMainType $productMainType;
  149.         return $this;
  150.     }
  151.     public function getTemplateType(): ?TemplateType
  152.     {
  153.         return $this->templateType;
  154.     }
  155.     public function setTemplateType(?TemplateType $templateType): self
  156.     {
  157.         $this->templateType $templateType;
  158.         return $this;
  159.     }
  160.     public function getProductAssociation(): ?ProductAssociation
  161.     {
  162.         return $this->productAssociation;
  163.     }
  164.     public function setProductAssociation(?ProductAssociation $productAssociation): self
  165.     {
  166.         $this->productAssociation $productAssociation;
  167.         return $this;
  168.     }
  169. }