src/Entity/Cours.php line 99

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\BooleanFilter;
  4. use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
  5. use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
  6. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  7. use ApiPlatform\Metadata\ApiFilter;
  8. use ApiPlatform\Metadata\ApiResource;
  9. use App\Repository\CoursRepository;
  10. use DateTimeImmutable;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\DBAL\Types\Types;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use ApiPlatform\Metadata\Get;
  16. use ApiPlatform\Metadata\GetCollection;
  17. use App\Controller\Api\Controller\Course\DetailsController;
  18. use App\Controller\Api\Controller\Course\ShowQuizzesController;
  19. use App\Controller\Api\Controller\Course\StartCourseController;
  20. use App\Controller\Api\Controller\Course\StudentCourseController;
  21. use Symfony\Component\Serializer\Annotation\Groups;
  22. use Symfony\Component\Validator\Constraints as Assert;
  23. #[ORM\Entity(repositoryClassCoursRepository::class)]
  24. #[
  25.     ApiResource(
  26.         operations: [
  27.             new GetCollection(
  28.                 options: ['isActivated' => true],
  29.                 normalizationContext: ['groups' => ['read:course:collection']]
  30.             ),
  31.             new Get(
  32.                 uriTemplate'/cours/{id}/details',
  33.                 controllerDetailsController::class,
  34.                 normalizationContext: ['groups' => ['read:course:collection''read:course:item']],
  35.                 writetrue,
  36.                 name'course_details'
  37.             ),
  38.             new GetCollection(
  39.                 uriTemplate'/student/{id}/courses',
  40.                 controllerStudentCourseController::class,
  41.                 openapiContext: [
  42.                     'security' => [['bearerAuth' => []]]
  43.                 ],
  44.                 normalizationContext: [
  45.                     'groups' => ['read:course:collection']
  46.                 ],
  47.                 readfalse
  48.             ),
  49.             new Get(
  50.                 uriTemplate'/cours/{id}/start',
  51.                 controllerStartCourseController::class,
  52.                 openapiContext: [
  53.                     'security' => [['bearerAuth' => []]]
  54.                 ],
  55.                 normalizationContext: [
  56.                     'groups' => ['read:lesson:item']
  57.                 ],
  58.                 readfalse
  59.             ),
  60.             new Get(
  61.                 uriTemplate'/cours/{id}/quizzes',
  62.                 controllerShowQuizzesController::class,
  63.                 openapiContext: [
  64.                     'security' => [['bearerAuth' => []]]
  65.                 ],
  66.                 normalizationContext: [
  67.                     'groups' => ['read:quizzes:collection']
  68.                 ],
  69.                 readfalse
  70.             ),
  71.         ],
  72.         normalizationContext: [
  73.             'groups' => ['read:course:collection']
  74.         ],
  75.         paginationClientItemsPerPagetrue,
  76.         paginationItemsPerPage10,
  77.         paginationMaximumItemsPerPage20,
  78.     ),
  79.     ApiFilter(
  80.         SearchFilter::class, properties: [
  81.             'id' => 'exact',
  82.             'categorie' => 'exact',
  83.             'intitule' => 'partial',
  84.             'language' => 'exact',
  85.             'classe' => 'exact',
  86.             'classe.specialite' => 'exact',
  87.             'classe.specialite.filiere' => 'exact',
  88.             'classe.skillLevel' => 'exact'
  89.         ]
  90.     ),
  91.     ApiFilter(BooleanFilter::class, properties: ['isFree''isValidated']),
  92.     ApiFilter(OrderFilter::class, properties: ['id''intitule'], arguments: ['orderParameterName' => 'order']),
  93.     ApiFilter(DateFilter::class, properties: ['publishedAt']),
  94. ]
  95. class Cours
  96. {
  97.     #[ORM\Id]
  98.     #[ORM\GeneratedValue]
  99.     #[ORM\Column]
  100.     #[Groups(['read:course:collection''read:payment:collection''read:lecture:collection''read:forum:item'])]
  101.     private ?int $id null;
  102.     #[ORM\ManyToMany(targetEntityClasse::class, inversedBy'cours')]
  103.     #[Groups(['read:course:collection'])]
  104.     private Collection $classe;
  105.     #[ORM\Column(length255)]
  106.     #[Assert\NotBlank(message"Ne peut Ãªtre vide !")]
  107.     #[Assert\NotNull(message"Ne peut Ãªtre nul !")]
  108.     #[Groups(['read:course:collection''read:payment:collection''read:lecture:collection''read:forum:item'])]
  109.     private ?string $intitule null;
  110.     #[ORM\Column(length255)]
  111.     #[Groups(['read:course:collection''read:forum:item'])]
  112.     private ?string $slug null;
  113.     #[ORM\Column(typeTypes::TEXT)]
  114.     #[Assert\NotBlank(message"Ne peut Ãªtre vide !")]
  115.     #[Assert\NotNull(message"Ne peut Ãªtre nul !")]
  116.     #[Groups(['read:course:item'])]
  117.     private ?string $content null;
  118.     #[ORM\Column(typeTypes::TEXT)]
  119.     #[Assert\NotBlank(message"Ne peut Ãªtre vide !")]
  120.     #[Assert\NotNull(message"Ne peut Ãªtre nul !")]
  121.     #[Groups(['read:course:collection'])]
  122.     private ?string $description null;
  123.     #[ORM\Column]
  124.     #[Groups(['read:course:collection''read:forum:item'])]
  125.     private ?bool $isPublished null;
  126.     #[ORM\Column]
  127.     #[Groups(['read:course:collection''read:payment:collection'])]
  128.     private ?bool $isFree null;
  129.     #[ORM\OneToMany(mappedBy'cours'cascade: ['persist''remove'], targetEntityChapitre::class, orphanRemovaltrue)]
  130.     #[Groups(['read:course:item''read:lesson:item'])]
  131.     private Collection $chapitres;
  132.     #[ORM\ManyToOne(inversedBy'cours')]
  133.     #[ORM\JoinColumn(nullablefalse)]
  134.     #[Groups(['read:course:collection''read:forum:item'])]
  135.     private ?Enseignant $enseignant null;
  136.     #[ORM\ManyToMany(targetEntityEleve::class, mappedBy'cours')]
  137.     
  138.     private Collection $eleves;
  139.     #[Groups(['read:course:item'])]
  140.     private $numberOfStudents;
  141.     #[ORM\ManyToMany(targetEntityFormation::class, mappedBy'cours')]
  142.     private Collection $formations;
  143.     #[ORM\Column(length255)]
  144.     #[Assert\NotBlank(message"Ne peut Ãªtre vide !")]
  145.     #[Assert\NotNull(message"Ne peut Ãªtre nul !")]
  146.     #[Groups(['read:course:collection''read:payment:collection'])]
  147.     private ?string $niveauDifficulte null;
  148.     #[ORM\Column(length255)]
  149.     #[Assert\NotBlank(message"Ne peut Ãªtre vide !")]
  150.     #[Assert\NotNull(message"Ne peut Ãªtre nul !")]
  151.     #[Groups(['read:course:collection''read:payment:collection'])]
  152.     private ?string $dureeApprentissage null;
  153.     #[ORM\Column]
  154.     #[Groups(['read:course:collection''read:payment:collection'])]
  155.     private ?\DateTimeImmutable $createdAt null;
  156.     #[ORM\Column]
  157.     #[Groups(['read:course:collection''update:course:item'])]
  158.     private ?int $vues null;
  159.     #[ORM\Column]
  160.     #[Groups(['read:course:collection''read:payment:collection'])]
  161.     private ?bool $isValidated null;
  162.     #[ORM\OneToMany(mappedBy'cours'targetEntityLike::class, orphanRemovaltrue)]
  163.     private Collection $likes;
  164.     #[ORM\Column(nullabletrue)]
  165.     #[Groups(['read:course:collection'])]
  166.     private ?int $montantAbonnement null;
  167.     #[ORM\ManyToOne(inversedBy'cours')]
  168.     #[Groups(['read:course:collection'])]
  169.     private ?Categorie $categorie null;
  170.     #[ORM\OneToOne(mappedBy'cours'cascade: ['persist''remove'])]
  171.     #[Groups(['read:course:collection'])]
  172.     private ?Media $media null;
  173.     #[ORM\OneToOne(mappedBy'cours'cascade: ['persist''remove'])]
  174.     #[Groups(['read:course:collection'])]
  175.     private ?Forum $forum null;
  176.     #[ORM\OneToMany(mappedBy'cours'targetEntityFAQ::class, cascade: ['persist''remove'], orphanRemovaltrue)]
  177.     #[Groups(['read:course:item'])]
  178.     private Collection $fAQs;
  179.     #[ORM\Column(length100)]
  180.     #[Groups(['read:course:collection''read:payment:collection'])]
  181.     private ?string $language null;
  182.     #[ORM\Column(typeTypes::SMALLINT)]
  183.     #[Groups(['read:course:collection''read:payment:collection'])]
  184.     private ?int $numberOfLessons null;
  185.     #[ORM\Column(length255nullabletrue)]
  186.     #[Groups(['read:course:collection'])]
  187.     private ?string $tags null;
  188.     #[ORM\Column(nullabletrue)]
  189.     #[Groups(['read:course:collection'])]
  190.     private ?bool $isRejected null;
  191.     #[ORM\OneToMany(mappedBy'cours'targetEntityReview::class, orphanRemovaltrue)]
  192.     private Collection $reviews;
  193.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  194.     #[Groups(['read:course:collection'])]
  195.     private ?int $review null;
  196.     #[ORM\Column(nullabletrue)]
  197.     #[Groups(['read:course:collection'])]
  198.     private ?\DateTimeImmutable $updatedAt null;
  199.     #[ORM\OneToMany(mappedBy'cours'targetEntityPayment::class)]
  200.     private Collection $payments;
  201.     #[ORM\ManyToMany(targetEntityPaymentMethod::class, inversedBy'cours')]
  202.     #[Groups(['read:course:item'])]
  203.     private Collection $paymentMethods;
  204.     #[ORM\OneToMany(mappedBy'cours'targetEntityLecture::class)]
  205.     private Collection $lectures;
  206.     #[ORM\OneToMany(mappedBy'cours'targetEntityQuiz::class)]
  207.     #[Groups(['read:quizzes:collection'])]
  208.     private Collection $quizzes;
  209.     #[ORM\Column(nullabletrue)]
  210.     #[Groups(['read:course:collection'])]
  211.     private ?\DateTimeImmutable $publishedAt null;
  212.     #[ORM\OneToMany(mappedBy'cours'targetEntityQuizLost::class)]
  213.     private Collection $quizLosts;
  214.     #[ORM\ManyToOne(inversedBy'cours')]
  215.     private ?SkillLevel $skillLevel null;
  216.     public function __construct()
  217.     {
  218.         $this->classe = new ArrayCollection();
  219.         $this->chapitres = new ArrayCollection();
  220.         $this->eleves = new ArrayCollection();
  221.         $this->formations = new ArrayCollection();
  222.         $this->likes = new ArrayCollection();
  223.         $this->isPublished false;
  224.         $this->isValidated false;
  225.         $this->isFree true;
  226.         $this->vues 0;
  227.         $this->createdAt = new DateTimeImmutable();
  228.         $this->fAQs = new ArrayCollection();
  229.         $this->reviews = new ArrayCollection();
  230.         $this->payments = new ArrayCollection();
  231.         $this->review 0;
  232.         $this->paymentMethods = new ArrayCollection();
  233.         $this->lectures = new ArrayCollection();
  234.         $this->quizzes = new ArrayCollection();
  235.         $this->quizLosts = new ArrayCollection();
  236.     }
  237.     public function getId(): ?int
  238.     {
  239.         return $this->id;
  240.     }
  241.     /**
  242.      * @return Collection<int, Classe>
  243.      */
  244.     public function getClasse(): Collection
  245.     {
  246.         return $this->classe;
  247.     }
  248.     public function addClasse(Classe $classe): self
  249.     {
  250.         if (!$this->classe->contains($classe)) {
  251.             $this->classe->add($classe);
  252.         }
  253.         return $this;
  254.     }
  255.     public function removeClasse(Classe $classe): self
  256.     {
  257.         $this->classe->removeElement($classe);
  258.         return $this;
  259.     }
  260.     public function getIntitule(): ?string
  261.     {
  262.         return $this->intitule;
  263.     }
  264.     public function setIntitule(string $intitule): self
  265.     {
  266.         $this->intitule $intitule;
  267.         return $this;
  268.     }
  269.     public function getSlug(): ?string
  270.     {
  271.         return $this->slug;
  272.     }
  273.     public function setSlug(string $slug): self
  274.     {
  275.         $this->slug $slug;
  276.         return $this;
  277.     }
  278.     public function getContent(): ?string
  279.     {
  280.         return $this->content;
  281.     }
  282.     public function setContent(string $content): self
  283.     {
  284.         $this->content $content;
  285.         return $this;
  286.     }
  287.     public function getDescription(): ?string
  288.     {
  289.         return $this->description;
  290.     }
  291.     public function setDescription(string $description): self
  292.     {
  293.         $this->description $description;
  294.         return $this;
  295.     }
  296.     public function isIsPublished(): ?bool
  297.     {
  298.         return $this->isPublished;
  299.     }
  300.     public function setIsPublished(bool $isPublished): self
  301.     {
  302.         $this->isPublished $isPublished;
  303.         return $this;
  304.     }
  305.     public function isIsFree(): ?bool
  306.     {
  307.         return $this->isFree;
  308.     }
  309.     public function setIsFree(bool $isFree): self
  310.     {
  311.         $this->isFree $isFree;
  312.         return $this;
  313.     }
  314.     /**
  315.      * @return Collection<int, Chapitre>
  316.      */
  317.     public function getChapitres(): Collection
  318.     {
  319.         return $this->chapitres;
  320.     }
  321.     public function addChapitre(Chapitre $chapitre): self
  322.     {
  323.         if (!$this->chapitres->contains($chapitre)) {
  324.             $this->chapitres->add($chapitre);
  325.             $chapitre->setCours($this);
  326.         }
  327.         return $this;
  328.     }
  329.     public function removeChapitre(Chapitre $chapitre): self
  330.     {
  331.         if ($this->chapitres->removeElement($chapitre)) {
  332.             // set the owning side to null (unless already changed)
  333.             if ($chapitre->getCours() === $this) {
  334.                 $chapitre->setCours(null);
  335.             }
  336.         }
  337.         return $this;
  338.     }
  339.     public function getEnseignant(): ?Enseignant
  340.     {
  341.         return $this->enseignant;
  342.     }
  343.     public function setEnseignant(?Enseignant $enseignant): self
  344.     {
  345.         $this->enseignant $enseignant;
  346.         return $this;
  347.     }
  348.     /**
  349.      * @return Collection<int, Eleve>
  350.      */
  351.     public function getEleves(): Collection
  352.     {
  353.         return $this->eleves;
  354.     }
  355.     public function addElefe(Eleve $elefe): self
  356.     {
  357.         if (!$this->eleves->contains($elefe)) {
  358.             $this->eleves->add($elefe);
  359.             $elefe->addCour($this);
  360.         }
  361.         return $this;
  362.     }
  363.     public function removeElefe(Eleve $elefe): self
  364.     {
  365.         if ($this->eleves->removeElement($elefe)) {
  366.             $elefe->removeCour($this);
  367.         }
  368.         return $this;
  369.     }
  370.     /**
  371.      * @return Collection<int, Formation>
  372.      */
  373.     public function getFormations(): Collection
  374.     {
  375.         return $this->formations;
  376.     }
  377.     public function addFormation(Formation $formation): self
  378.     {
  379.         if (!$this->formations->contains($formation)) {
  380.             $this->formations->add($formation);
  381.             $formation->addCour($this);
  382.         }
  383.         return $this;
  384.     }
  385.     public function removeFormation(Formation $formation): self
  386.     {
  387.         if ($this->formations->removeElement($formation)) {
  388.             $formation->removeCour($this);
  389.         }
  390.         return $this;
  391.     }
  392.     public function getNiveauDifficulte(): ?string
  393.     {
  394.         return $this->niveauDifficulte;
  395.     }
  396.     public function setNiveauDifficulte(string $niveauDifficulte): self
  397.     {
  398.         $this->niveauDifficulte $niveauDifficulte;
  399.         return $this;
  400.     }
  401.     public function getDureeApprentissage(): ?string
  402.     {
  403.         return $this->dureeApprentissage;
  404.     }
  405.     public function setDureeApprentissage(string $dureeApprentissage): self
  406.     {
  407.         $this->dureeApprentissage $dureeApprentissage;
  408.         return $this;
  409.     }
  410.     public function getCreatedAt(): ?\DateTimeImmutable
  411.     {
  412.         return $this->createdAt;
  413.     }
  414.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  415.     {
  416.         $this->createdAt $createdAt;
  417.         return $this;
  418.     }
  419.     public function getVues(): ?int
  420.     {
  421.         return $this->vues;
  422.     }
  423.     public function setVues(int $vues): self
  424.     {
  425.         $this->vues $vues;
  426.         return $this;
  427.     }
  428.     public function isIsValidated(): ?bool
  429.     {
  430.         return $this->isValidated;
  431.     }
  432.     public function setIsValidated(bool $isValidated): self
  433.     {
  434.         $this->isValidated $isValidated;
  435.         return $this;
  436.     }
  437.     /**
  438.      * @return Collection<int, Like>
  439.      */
  440.     public function getLikes(): Collection
  441.     {
  442.         return $this->likes;
  443.     }
  444.     public function addLike(Like $like): self
  445.     {
  446.         if (!$this->likes->contains($like)) {
  447.             $this->likes->add($like);
  448.             $like->setCours($this);
  449.         }
  450.         return $this;
  451.     }
  452.     public function removeLike(Like $like): self
  453.     {
  454.         if ($this->likes->removeElement($like)) {
  455.             // set the owning side to null (unless already changed)
  456.             if ($like->getCours() === $this) {
  457.                 $like->setCours(null);
  458.             }
  459.         }
  460.         return $this;
  461.     }
  462.     public function getMontantAbonnement(): ?int
  463.     {
  464.         return $this->montantAbonnement;
  465.     }
  466.     public function setMontantAbonnement(?int $montantAbonnement): self
  467.     {
  468.         $this->montantAbonnement $montantAbonnement;
  469.         return $this;
  470.     }
  471.     public function getProf(): ?string
  472.     {
  473.         return $this->enseignant->getUtilisateur()->getPersonne()->getName();
  474.     }
  475.     public function getCategorie(): ?Categorie
  476.     {
  477.         return $this->categorie;
  478.     }
  479.     public function setCategorie(?Categorie $categorie): self
  480.     {
  481.         $this->categorie $categorie;
  482.         return $this;
  483.     }
  484.     public function getMedia(): ?Media
  485.     {
  486.         return $this->media;
  487.     }
  488.     public function setMedia(Media $media): self
  489.     {
  490.         // set the owning side of the relation if necessary
  491.         if ($media->getCours() !== $this) {
  492.             $media->setCours($this);
  493.         }
  494.         $this->media $media;
  495.         return $this;
  496.     }
  497.     public function getForum(): ?Forum
  498.     {
  499.         return $this->forum;
  500.     }
  501.     public Function setForum(Forum $forum): self
  502.     {
  503.         if ($forum->getCours() !== $this) {
  504.             $forum->setCours($this);
  505.         }
  506.         $this->forum $forum;
  507.         return $this;
  508.     }
  509.     /**
  510.      * @return Collection<int, FAQ>
  511.      */
  512.     public function getFAQs(): Collection
  513.     {
  514.         return $this->fAQs;
  515.     }
  516.     public function addFAQ(FAQ $fAQ): self
  517.     {
  518.         if (!$this->fAQs->contains($fAQ)) {
  519.             $this->fAQs->add($fAQ);
  520.             $fAQ->setCours($this);
  521.         }
  522.         return $this;
  523.     }
  524.     public function removeFAQ(FAQ $fAQ): self
  525.     {
  526.         if ($this->fAQs->removeElement($fAQ)) {
  527.             // set the owning side to null (unless already changed)
  528.             if ($fAQ->getCours() === $this) {
  529.                 $fAQ->setCours(null);
  530.             }
  531.         }
  532.         return $this;
  533.     }
  534.     public function getLanguage(): ?string
  535.     {
  536.         return $this->language;
  537.     }
  538.     public function setLanguage(string $language): self
  539.     {
  540.         $this->language $language;
  541.         return $this;
  542.     }
  543.     public function getNumberOfLessons(): ?int
  544.     {
  545.         return $this->numberOfLessons;
  546.     }
  547.     public function setNumberOfLessons(int $numberOfLessons): self
  548.     {
  549.         $this->numberOfLessons $numberOfLessons;
  550.         return $this;
  551.     }
  552.     public function getTags(): ?string
  553.     {
  554.         return $this->tags;
  555.     }
  556.     public function setTags(?string $tags): self
  557.     {
  558.         $this->tags $tags;
  559.         return $this;
  560.     }
  561.     public function isIsRejected(): ?bool
  562.     {
  563.         return $this->isRejected;
  564.     }
  565.     public function setIsRejected(?bool $isRejected): self
  566.     {
  567.         $this->isRejected $isRejected;
  568.         return $this;
  569.     }
  570.     /**
  571.      * @return Collection<int, Review>
  572.      */
  573.     public function getReviews(): Collection
  574.     {
  575.         return $this->reviews;
  576.     }
  577.     public function addReview(Review $review): self
  578.     {
  579.         if (!$this->reviews->contains($review)) {
  580.             $this->reviews->add($review);
  581.             $review->setCours($this);
  582.         }
  583.         return $this;
  584.     }
  585.     public function removeReview(Review $review): self
  586.     {
  587.         if ($this->reviews->removeElement($review)) {
  588.             // set the owning side to null (unless already changed)
  589.             if ($review->getCours() === $this) {
  590.                 $review->setCours(null);
  591.             }
  592.         }
  593.         return $this;
  594.     }
  595.     public function getReview(): ?int
  596.     {
  597.         return $this->review;
  598.     }
  599.     public function setReview(?int $review): self
  600.     {
  601.         $this->review $review;
  602.         return $this;
  603.     }
  604.     public function getUpdatedAt(): ?\DateTimeImmutable
  605.     {
  606.         return $this->updatedAt;
  607.     }
  608.     public function setUpdatedAt(?\DateTimeImmutable $updatedAt): self
  609.     {
  610.         $this->updatedAt $updatedAt;
  611.         return $this;
  612.     }
  613.     /**
  614.      * @return Collection<int, Payment>
  615.      */
  616.     public function getPayments(): Collection
  617.     {
  618.         return $this->payments;
  619.     }
  620.     public function addPayment(Payment $payment): self
  621.     {
  622.         if (!$this->payments->contains($payment)) {
  623.             $this->payments->add($payment);
  624.             $payment->setCours($this);
  625.         }
  626.         return $this;
  627.     }
  628.     public function removePayment(Payment $payment): self
  629.     {
  630.         if ($this->payments->removeElement($payment)) {
  631.             // set the owning side to null (unless already changed)
  632.             if ($payment->getCours() === $this) {
  633.                 $payment->setCours(null);
  634.             }
  635.         }
  636.         return $this;
  637.     }
  638.     /**
  639.      * @return Collection<int, PaymentMethod>
  640.      */
  641.     public function getPaymentMethods(): Collection
  642.     {
  643.         return $this->paymentMethods;
  644.     }
  645.     public function addPaymentMethod(PaymentMethod $paymentMethod): self
  646.     {
  647.         if (!$this->paymentMethods->contains($paymentMethod)) {
  648.             $this->paymentMethods->add($paymentMethod);
  649.         }
  650.         return $this;
  651.     }
  652.     public function removePaymentMethod(PaymentMethod $paymentMethod): self
  653.     {
  654.         $this->paymentMethods->removeElement($paymentMethod);
  655.         return $this;
  656.     }
  657.     /**
  658.      * @return Collection<int, Lecture>
  659.      */
  660.     public function getLectures(): Collection
  661.     {
  662.         return $this->lectures;
  663.     }
  664.     public function addLecture(Lecture $lecture): self
  665.     {
  666.         if (!$this->lectures->contains($lecture)) {
  667.             $this->lectures->add($lecture);
  668.             $lecture->setCours($this);
  669.         }
  670.         return $this;
  671.     }
  672.     public function removeLecture(Lecture $lecture): self
  673.     {
  674.         if ($this->lectures->removeElement($lecture)) {
  675.             // set the owning side to null (unless already changed)
  676.             if ($lecture->getCours() === $this) {
  677.                 $lecture->setCours(null);
  678.             }
  679.         }
  680.         return $this;
  681.     }
  682.     /**
  683.      * @return Collection<int, Quiz>
  684.      */
  685.     public function getQuizzes(): Collection
  686.     {
  687.         return $this->quizzes;
  688.     }
  689.     public function addQuiz(Quiz $quiz): self
  690.     {
  691.         if (!$this->quizzes->contains($quiz)) {
  692.             $this->quizzes->add($quiz);
  693.             $quiz->setCours($this);
  694.         }
  695.         return $this;
  696.     }
  697.     public function removeQuiz(Quiz $quiz): self
  698.     {
  699.         if ($this->quizzes->removeElement($quiz)) {
  700.             // set the owning side to null (unless already changed)
  701.             if ($quiz->getCours() === $this) {
  702.                 $quiz->setCours(null);
  703.             }
  704.         }
  705.         return $this;
  706.     }
  707.     public function getPublishedAt(): ?\DateTimeImmutable
  708.     {
  709.         return $this->publishedAt;
  710.     }
  711.     public function setPublishedAt(?\DateTimeImmutable $publishedAt): self
  712.     {
  713.         $this->publishedAt $publishedAt;
  714.         return $this;
  715.     }
  716.     /**
  717.      * @return Collection<int, QuizLost>
  718.      */
  719.     public function getQuizLosts(): Collection
  720.     {
  721.         return $this->quizLosts;
  722.     }
  723.     public function addQuizLost(QuizLost $quizLost): self
  724.     {
  725.         if (!$this->quizLosts->contains($quizLost)) {
  726.             $this->quizLosts->add($quizLost);
  727.             $quizLost->setCours($this);
  728.         }
  729.         return $this;
  730.     }
  731.     public function removeQuizLost(QuizLost $quizLost): self
  732.     {
  733.         if ($this->quizLosts->removeElement($quizLost)) {
  734.             // set the owning side to null (unless already changed)
  735.             if ($quizLost->getCours() === $this) {
  736.                 $quizLost->setCours(null);
  737.             }
  738.         }
  739.         return $this;
  740.     }
  741.     public function getNumberOfStudents(): int
  742.     {
  743.         return $this->getEleves()->count();
  744.     }
  745.     public function getSkillLevel(): ?SkillLevel
  746.     {
  747.         return $this->skillLevel;
  748.     }
  749.     public function setSkillLevel(?SkillLevel $skillLevel): self
  750.     {
  751.         $this->skillLevel $skillLevel;
  752.         return $this;
  753.     }
  754. }