src/Entity/CourseTag.php line 13
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use App\Repository\CourseTagRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: CourseTagRepository::class)]#[ApiResource]class CourseTag{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\Column(length: 255)]private ?string $color = null;#[ORM\OneToMany(mappedBy: 'courseTag', targetEntity: Course::class)]private Collection $courses;public function __construct(){$this->courses = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function __toString(): string{return $this->name;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}public function getColor(): ?string{return $this->color;}public function setColor(string $color): self{$this->color = $color;return $this;}/*** @return Collection<int, Course>*/public function getCourses(): Collection{return $this->courses;}public function addCourse(Course $course): self{if (!$this->courses->contains($course)) {$this->courses->add($course);$course->setCourseTag($this);}return $this;}public function removeCourse(Course $course): self{if ($this->courses->removeElement($course)) {// set the owning side to null (unless already changed)if ($course->getCourseTag() === $this) {$course->setCourseTag(null);}}return $this;}}