src/Entity/Tag.php line 12
<?phpnamespace App\Entity;use App\Repository\TagRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: TagRepository::class)]class Tag{#[Groups(['main'])]#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[Groups(['main'])]#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\ManyToOne(inversedBy: 'tags')]#[ORM\JoinColumn(nullable: false)]private ?TagCategory $category = null;#[ORM\ManyToMany(targetEntity: Video::class, mappedBy: 'tags')]private Collection $videos;public function __construct(){$this->videos = 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 getCategory(): ?TagCategory{return $this->category;}public function setCategory(?TagCategory $category): self{$this->category = $category;return $this;}#[Groups(['main'])]public function getCategoryId(): ?int{return $this->getCategory()->getId();}/*** @return Collection<int, Video>*/public function getVideos(): Collection{return $this->videos;}public function addVideo(Video $video): self{if (!$this->videos->contains($video)) {$this->videos->add($video);$video->addTag($this);}return $this;}public function removeVideo(Video $video): self{if ($this->videos->removeElement($video)) {$video->removeTag($this);}return $this;}}