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. {
  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=Titles::class, mappedBy="tag")
  28.      */
  29.     private $titles;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=About::class, mappedBy="tag")
  32.      */
  33.     private $abouts;
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=Activities::class, mappedBy="tag")
  36.      */
  37.     private $activities;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity=Documents::class, mappedBy="tag")
  40.      */
  41.     private $documents;
  42.     public function __construct()
  43.     {
  44.         $this->titles = new ArrayCollection();
  45.         $this->abouts = new ArrayCollection();
  46.         $this->activities = new ArrayCollection();
  47.         $this->documents = new ArrayCollection();
  48.     }
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getName(): ?string
  54.     {
  55.         return $this->name;
  56.     }
  57.     public function setName(string $name): self
  58.     {
  59.         $this->name = $name;
  60.         return $this;
  61.     }
  62. //    public function getSlug(): ?string
  63. //    {
  64. //        return $this->slug;
  65. //    }
  66. //
  67. //    public function setSlug(string $slug): self
  68. //    {
  69. //        $this->slug = $slug;
  70. //
  71. //        return $this;
  72. //    }
  73.     /**
  74.      * @return Collection<int, Titles>
  75.      */
  76.     public function getTitles(): Collection
  77.     {
  78.         return $this->titles;
  79.     }
  80.     public function addTitle(Titles $title): self
  81.     {
  82.         if (!$this->titles->contains($title)) {
  83.             $this->titles[] = $title;
  84.             $title->setTag($this);
  85.         }
  86.         return $this;
  87.     }
  88.     public function removeTitle(Titles $title): self
  89.     {
  90.         if ($this->titles->removeElement($title)) {
  91.             // set the owning side to null (unless already changed)
  92.             if ($title->getTag() === $this) {
  93.                 $title->setTag(null);
  94.             }
  95.         }
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection<int, About>
  100.      */
  101.     public function getAbouts(): Collection
  102.     {
  103.         return $this->abouts;
  104.     }
  105.     public function addAbout(About $about): self
  106.     {
  107.         if (!$this->abouts->contains($about)) {
  108.             $this->abouts[] = $about;
  109.             $about->setTag($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeAbout(About $about): self
  114.     {
  115.         if ($this->abouts->removeElement($about)) {
  116.             // set the owning side to null (unless already changed)
  117.             if ($about->getTag() === $this) {
  118.                 $about->setTag(null);
  119.             }
  120.         }
  121.         return $this;
  122.     }
  123.     public function __toString()
  124.     {
  125.         return $this->name;
  126.     }
  127.     /**
  128.      * @return Collection<int, Activities>
  129.      */
  130.     public function getActivities(): Collection
  131.     {
  132.         return $this->activities;
  133.     }
  134.     public function addActivity(Activities $activity): self
  135.     {
  136.         if (!$this->activities->contains($activity)) {
  137.             $this->activities[] = $activity;
  138.             $activity->setTagù($this);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removeActivity(Activities $activity): self
  143.     {
  144.         if ($this->activities->removeElement($activity)) {
  145.             // set the owning side to null (unless already changed)
  146.             if ($activity->getTagù() === $this) {
  147.                 $activity->setTagù(null);
  148.             }
  149.         }
  150.         return $this;
  151.     }
  152.     /**
  153.      * @return Collection<int, Documents>
  154.      */
  155.     public function getDocuments(): Collection
  156.     {
  157.         return $this->documents;
  158.     }
  159.     public function addDocument(Documents $document): self
  160.     {
  161.         if (!$this->documents->contains($document)) {
  162.             $this->documents[] = $document;
  163.             $document->addTag($this);
  164.         }
  165.         return $this;
  166.     }
  167.     public function removeDocument(Documents $document): self
  168.     {
  169.         if ($this->documents->removeElement($document)) {
  170.             $document->removeTag($this);
  171.         }
  172.         return $this;
  173.     }
  174. }