<?phpnamespace App\Entity;use App\Repository\EnrollmentRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=EnrollmentRepository::class) */class Enrollment{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\ManyToOne(targetEntity=User::class, inversedBy="enrollments") * @ORM\JoinColumn(nullable=false) */ private $user; /** * @ORM\ManyToOne(targetEntity=Course::class, inversedBy="enrollments") * @ORM\JoinColumn(nullable=false) */ private $course; /** * @ORM\Column(type="datetime") */ private $enrollmentDate; /** * @ORM\OneToMany(targetEntity=LearningProgress::class, mappedBy="enrollment") */ private $learningProgress; public function __construct() { $this->learningProgress = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getCourse(): ?Course { return $this->course; } public function setCourse(?Course $course): self { $this->course = $course; return $this; } public function getEnrollmentDate(): ?\DateTimeInterface { return $this->enrollmentDate; } public function setEnrollmentDate(\DateTimeInterface $enrollmentDate): self { $this->enrollmentDate = $enrollmentDate; return $this; } /** * @return Collection<int, LearningProgress> */ public function getLearningProgress(): Collection { return $this->learningProgress; } public function addLearningProgress(LearningProgress $learningProgress): self { if (!$this->learningProgress->contains($learningProgress)) { $this->learningProgress[] = $learningProgress; $learningProgress->setEnrollment($this); } return $this; } public function removeLearningProgress(LearningProgress $learningProgress): self { if ($this->learningProgress->removeElement($learningProgress)) { // set the owning side to null (unless already changed) if ($learningProgress->getEnrollment() === $this) { $learningProgress->setEnrollment(null); } } return $this; }}