<?phpnamespace App\Entity;use App\Repository\TagRepository;use App\Traits\CommonTrt;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=TagRepository::class) */class Tag{ use CommonTrt; /** * @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\ManyToMany(targetEntity=SectionTitle::class, mappedBy="tag") */ private $sectionTitles; /** * @ORM\ManyToMany(targetEntity=Documents::class, mappedBy="tag") */ private $documents; public function __construct() { $this->sectionTitles = 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, SectionTitle> */ public function getSectionTitles(): Collection { return $this->sectionTitles; } public function addSectionTitle(SectionTitle $sectionTitle): self { if (!$this->sectionTitles->contains($sectionTitle)) { $this->sectionTitles[] = $sectionTitle; $sectionTitle->addTag($this); } return $this; } public function removeSectionTitle(SectionTitle $sectionTitle): self { if ($this->sectionTitles->removeElement($sectionTitle)) { $sectionTitle->removeTag($this); } return $this; } /** * @return Collection|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; }}