<?php
namespace App\Entity;
use App\Repository\TagRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=TagRepository::class)
*/
class Tag
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
// /**
// * @ORM\Column(type="string", length=255)
// */
// private $slug;
/**
* @ORM\OneToMany(targetEntity=Titles::class, mappedBy="tag")
*/
private $titles;
/**
* @ORM\OneToMany(targetEntity=About::class, mappedBy="tag")
*/
private $abouts;
/**
* @ORM\OneToMany(targetEntity=Activities::class, mappedBy="tag")
*/
private $activities;
/**
* @ORM\ManyToMany(targetEntity=Documents::class, mappedBy="tag")
*/
private $documents;
public function __construct()
{
$this->titles = new ArrayCollection();
$this->abouts = new ArrayCollection();
$this->activities = new ArrayCollection();
$this->documents = 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 getSlug(): ?string
// {
// return $this->slug;
// }
//
// public function setSlug(string $slug): self
// {
// $this->slug = $slug;
//
// return $this;
// }
/**
* @return Collection<int, Titles>
*/
public function getTitles(): Collection
{
return $this->titles;
}
public function addTitle(Titles $title): self
{
if (!$this->titles->contains($title)) {
$this->titles[] = $title;
$title->setTag($this);
}
return $this;
}
public function removeTitle(Titles $title): self
{
if ($this->titles->removeElement($title)) {
// set the owning side to null (unless already changed)
if ($title->getTag() === $this) {
$title->setTag(null);
}
}
return $this;
}
/**
* @return Collection<int, About>
*/
public function getAbouts(): Collection
{
return $this->abouts;
}
public function addAbout(About $about): self
{
if (!$this->abouts->contains($about)) {
$this->abouts[] = $about;
$about->setTag($this);
}
return $this;
}
public function removeAbout(About $about): self
{
if ($this->abouts->removeElement($about)) {
// set the owning side to null (unless already changed)
if ($about->getTag() === $this) {
$about->setTag(null);
}
}
return $this;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection<int, Activities>
*/
public function getActivities(): Collection
{
return $this->activities;
}
public function addActivity(Activities $activity): self
{
if (!$this->activities->contains($activity)) {
$this->activities[] = $activity;
$activity->setTagù($this);
}
return $this;
}
public function removeActivity(Activities $activity): self
{
if ($this->activities->removeElement($activity)) {
// set the owning side to null (unless already changed)
if ($activity->getTagù() === $this) {
$activity->setTagù(null);
}
}
return $this;
}
/**
* @return Collection<int, Documents>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Documents $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->addTag($this);
}
return $this;
}
public function removeDocument(Documents $document): self
{
if ($this->documents->removeElement($document)) {
$document->removeTag($this);
}
return $this;
}
}