<?php
namespace App\Entity;
use App\Repository\SubjectTagRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass=SubjectTagRepository::class)
* @Serializer\ExclusionPolicy("ALL")
*/
class SubjectTag extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Expose
* @Serializer\Groups({"ligth_list"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
* @Serializer\Groups({"ligth_list"})
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=Subject::class, inversedBy="subjectTags")
*/
private $subjects;
public function __construct()
{
$this->subjects = 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;
}
/**
* @return Collection<int, Subject>
*/
public function getSubjects(): Collection
{
return $this->subjects;
}
public function addSubject(Subject $subject): self
{
if (!$this->subjects->contains($subject)) {
$this->subjects[] = $subject;
}
return $this;
}
public function removeSubject(Subject $subject): self
{
$this->subjects->removeElement($subject);
return $this;
}
}