<?phpnamespace App\Entity;use App\Repository\CertificateRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=CertificateRepository::class) */class Certificate{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="integer") */ private $level; /** * @ORM\OneToMany(targetEntity=Course::class, mappedBy="certificate") */ private $courses; public function __construct() { $this->courses = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getLevel(): ?int { return $this->level; } public function setLevel(int $level): self { $this->level = $level; 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->setCertificate($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->getCertificate() === $this) { $course->setCertificate(null); } } return $this; }}