src/Entity/Tag.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TagRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TagRepository::class)
  9.  */
  10. class Tag {
  11.     use \App\Traits\CommonTrt;
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255)
  24.      */
  25.     private $slug;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=SectionTitle::class, mappedBy="tag")
  28.      */
  29.     private $SectionTitle;
  30.     /**
  31.      * @ORM\ManyToMany(targetEntity=About::class, mappedBy="tag")
  32.      */
  33.     private $abouts;
  34.     /**
  35.      * @ORM\ManyToMany(targetEntity=Documents::class, mappedBy="tag")
  36.      */
  37.     private $documents;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=Services::class, mappedBy="tag")
  40.      */
  41.     private $services;
  42.     public function __construct() {
  43.         $this->documents = new ArrayCollection();
  44.         $this->SectionTitle = new ArrayCollection();
  45.         $this->abouts = new ArrayCollection();
  46.         $this->services = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self {
  55.         $this->name = $name;
  56.         return $this;
  57.     }
  58.     public function getSlug(): ?string {
  59.         return $this->slug;
  60.     }
  61.     public function setSlug(string $slug): self {
  62.         $this->slug = $slug;
  63.         return $this;
  64.     }
  65.     /**
  66.      * @return Collection|Documents[]
  67.      */
  68.     public function getDocuments(): Collection
  69.     {
  70.         return $this->documents;
  71.     }
  72.     public function addDocument(Documents $document): self
  73.     {
  74.         if (!$this->documents->contains($document)) {
  75.             $this->documents[] = $document;
  76.             $document->addTag($this);
  77.         }
  78.         return $this;
  79.     }
  80.     public function removeDocument(Documents $document): self
  81.     {
  82.         if ($this->documents->removeElement($document)) {
  83.             $document->removeTag($this);
  84.         }
  85.         return $this;
  86.     }
  87.     /**
  88.      * @return Collection<int, SectionTitle>
  89.      */
  90.     public function getSectionTitle(): Collection
  91.     {
  92.         return $this->SectionTitle;
  93.     }
  94.     /**
  95.      * @return Collection<int, About>
  96.      */
  97.     public function getAbouts(): Collection
  98.     {
  99.         return $this->abouts;
  100.     }
  101.     public function addAbout(About $about): self
  102.     {
  103.         if (!$this->abouts->contains($about)) {
  104.             $this->abouts[] = $about;
  105.             $about->addTag($this);
  106.         }
  107.         return $this;
  108.     }
  109.     public function removeAbout(About $about): self
  110.     {
  111.         if ($this->abouts->removeElement($about)) {
  112.             $about->removeTag($this);
  113.         }
  114.         return $this;
  115.     }
  116.     /**
  117.      * @return Collection<int, Services>
  118.      */
  119.     public function getServices(): Collection
  120.     {
  121.         return $this->services;
  122.     }
  123.     public function addService(Services $service): self
  124.     {
  125.         if (!$this->services->contains($service)) {
  126.             $this->services[] = $service;
  127.             $service->setTag($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function removeService(Services $service): self
  132.     {
  133.         if ($this->services->removeElement($service)) {
  134.             // set the owning side to null (unless already changed)
  135.             if ($service->getTag() === $this) {
  136.                 $service->setTag(null);
  137.             }
  138.         }
  139.         return $this;
  140.     }
  141. }