<?phpnamespace App\Entity;use App\Repository\CourseCategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CourseCategoryRepository::class) */class CourseCategory extends BaseEntity{ /** * @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 $type; /** * @ORM\OneToMany(targetEntity=Course::class, mappedBy="category") */ private $courses; public function __construct() { $this->courses = 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 getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; 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[] = $course; $course->setCategory($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->getCategory() === $this) { $course->setCategory(null); } } return $this; }}