src/Entity/Eleve.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EleveRepository;
  4. use DateTimeImmutable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ ORM\EntityrepositoryClassEleveRepository::class ) ]
  10. class Eleve
  11.  {
  12.     #[ ORM\Id ]
  13.     #[ ORM\GeneratedValue ]
  14.     #[ ORM\Column ]
  15.     #[ Groups( [ 'read:course:item''read:user:item''read:quizresult:collection''read:review:collection' ] ) ]
  16.     private ?int $id null;
  17.     #[ ORM\ManyToOneinversedBy'eleves' ) ]
  18.     #[ Groups( [ 'post:user:item' ] ) ]
  19.     private ?Classe $classe null;
  20.     #[ ORM\ManyToManytargetEntityCours::class, inversedBy'eleves' ) ]
  21.     private Collection $cours;
  22.     #[ ORM\ManyToManytargetEntityFormation::class, mappedBy'eleves' ) ]
  23.     private Collection $formations;
  24.     #[ ORM\OneToManymappedBy'eleve'targetEntityReponse::class, orphanRemovaltrue ) ]
  25.     private Collection $reponses;
  26.     #[ ORM\OneToOneinversedBy'eleve'cascade: [ 'persist''remove' ] ) ]
  27.     #[ ORM\JoinColumnnullablefalse ) ]
  28.     #[ Groups( [ 'read:course:item''read:quizresult:collection''read:review:collection' ] ) ]
  29.     private ?User $utilisateur null;
  30.     #[ ORM\ManyToOneinversedBy'eleves' ) ]
  31.     #[ ORM\JoinColumnnullabletrue ) ]
  32.     #[ Groups( [ 'post:user:item' ] ) ]
  33.     private ?Etablissement $etablissement null;
  34.     #[ ORM\Columnlength100uniquetrue ) ]
  35.     #[ Groups( [ 'read:user:item''read:review:collection' ] ) ]
  36.     private ?string $reference null;
  37.     #[ ORM\OneToManymappedBy'eleve'targetEntityReview::class ) ]
  38.     private Collection $reviews;
  39.     #[ ORM\Column ]
  40.     #[ Groups( [ 'read:user:item''read:review:collection' ] ) ]
  41.     private ?\DateTimeImmutable $joinAt null;
  42.     #[ ORM\OneToManymappedBy'eleve'targetEntityPayment::class, orphanRemovaltrue ) ]
  43.     private Collection $payments;
  44.     #[ ORM\Columnnullabletrue ) ]
  45.     #[ Groups( [ 'read:user:item''read:review:collection' ] ) ]
  46.     private ?bool $isPremium null;
  47.     #[ ORM\OneToManymappedBy'eleve'targetEntityLecture::class, orphanRemovaltrue ) ]
  48.     private Collection $lectures;
  49.     #[ ORM\OneToManymappedBy'eleve'targetEntityQuizResult::class, orphanRemovaltrue ) ]
  50.     private Collection $quizResults;
  51.     #[ ORM\OneToManymappedBy'eleve'targetEntityQuizLost::class, orphanRemovaltrue ) ]
  52.     private Collection $quizLosts;
  53.     #[ ORM\ManyToManytargetEntityEvaluation::class, mappedBy'Eleves' ) ]
  54.     private Collection $evaluations;
  55.     #[ ORM\OneToManymappedBy'eleve'targetEntityEvaluationResultat::class, orphanRemovaltrue ) ]
  56.     private Collection $evaluationResultats;
  57.     #[ORM\OneToMany(mappedBy'eleve'targetEntitySubjectChat::class, orphanRemovaltrue)]
  58.     private Collection $subjectChats;
  59.     public function __construct()
  60.  {
  61.         $this->cours = new ArrayCollection();
  62.         $this->formations = new ArrayCollection();
  63.         $this->reponses = new ArrayCollection();
  64.         $this->reviews = new ArrayCollection();
  65.         $this->joinAt = new DateTimeImmutable();
  66.         $this->payments = new ArrayCollection();
  67.         $this->lectures = new ArrayCollection();
  68.         $this->quizResults = new ArrayCollection();
  69.         $this->isPremium false;
  70.         $this->quizLosts = new ArrayCollection();
  71.         $this->evaluations = new ArrayCollection();
  72.         $this->evaluationResultats = new ArrayCollection();
  73.         $this->subjectChats = new ArrayCollection();
  74.     }
  75.     public function getId(): ?int
  76.  {
  77.         return $this->id;
  78.     }
  79.     public function getClasse(): ?Classe
  80.  {
  81.         return $this->classe;
  82.     }
  83.     public function setClasse( ?Classe $classe ): self
  84.  {
  85.         $this->classe $classe;
  86.         return $this;
  87.     }
  88.     /**
  89.     * @return Collection<int, Cours>
  90.     */
  91.     public function getCours(): Collection
  92.  {
  93.         return $this->cours;
  94.     }
  95.     public function addCourCours $cour ): self
  96.  {
  97.         if ( !$this->cours->contains$cour ) ) {
  98.             $this->cours->add$cour );
  99.         }
  100.         return $this;
  101.     }
  102.     public function removeCourCours $cour ): self
  103.  {
  104.         $this->cours->removeElement$cour );
  105.         return $this;
  106.     }
  107.     /**
  108.     * @return Collection<int, Formation>
  109.     */
  110.     public function getFormations(): Collection
  111.  {
  112.         return $this->formations;
  113.     }
  114.     public function addFormationFormation $formation ): self
  115.  {
  116.         if ( !$this->formations->contains$formation ) ) {
  117.             $this->formations->add$formation );
  118.             $formation->addElefe$this );
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeFormationFormation $formation ): self
  123.  {
  124.         if ( $this->formations->removeElement$formation ) ) {
  125.             $formation->removeElefe$this );
  126.         }
  127.         return $this;
  128.     }
  129.     /**
  130.     * @return Collection<int, Reponse>
  131.     */
  132.     public function getReponses(): Collection
  133.  {
  134.         return $this->reponses;
  135.     }
  136.     public function addReponseReponse $reponse ): self
  137.  {
  138.         if ( !$this->reponses->contains$reponse ) ) {
  139.             $this->reponses->add$reponse );
  140.             $reponse->setEleve$this );
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeReponseReponse $reponse ): self
  145.  {
  146.         if ( $this->reponses->removeElement$reponse ) ) {
  147.             // set the owning side to null ( unless already changed )
  148.             if ( $reponse->getEleve() === $this ) {
  149.                 $reponse->setElevenull );
  150.             }
  151.         }
  152.         return $this;
  153.     }
  154.     public function getUtilisateur(): ?User
  155.  {
  156.         return $this->utilisateur;
  157.     }
  158.     public function setUtilisateurUser $utilisateur ): self
  159.  {
  160.         $this->utilisateur $utilisateur;
  161.         return $this;
  162.     }
  163.     public function getEtablissement(): ?Etablissement
  164.  {
  165.         return $this->etablissement;
  166.     }
  167.     public function setEtablissement( ?Etablissement $etablissement ): self
  168.  {
  169.         $this->etablissement $etablissement;
  170.         return $this;
  171.     }
  172.     public function getReference(): ?string
  173.  {
  174.         return $this->reference;
  175.     }
  176.     public function setReferencestring $reference ): self
  177.  {
  178.         $this->reference $reference;
  179.         return $this;
  180.     }
  181.     /**
  182.     * @return Collection<int, Review>
  183.     */
  184.     public function getReviews(): Collection
  185.  {
  186.         return $this->reviews;
  187.     }
  188.     public function addReviewReview $review ): self
  189.  {
  190.         if ( !$this->reviews->contains$review ) ) {
  191.             $this->reviews->add$review );
  192.             $review->setEleve$this );
  193.         }
  194.         return $this;
  195.     }
  196.     public function removeReviewReview $review ): self
  197.  {
  198.         if ( $this->reviews->removeElement$review ) ) {
  199.             // set the owning side to null ( unless already changed )
  200.             if ( $review->getEleve() === $this ) {
  201.                 $review->setElevenull );
  202.             }
  203.         }
  204.         return $this;
  205.     }
  206.     public function getJoinAt(): ?\DateTimeImmutable
  207.  {
  208.         return $this->joinAt;
  209.     }
  210.     public function setJoinAt\DateTimeImmutable $joinAt ): self
  211.  {
  212.         $this->joinAt $joinAt;
  213.         return $this;
  214.     }
  215.     /**
  216.     * @return Collection<int, Payment>
  217.     */
  218.     public function getPayments(): Collection
  219.  {
  220.         return $this->payments;
  221.     }
  222.     public function addPaymentPayment $payment ): self
  223.  {
  224.         if ( !$this->payments->contains$payment ) ) {
  225.             $this->payments->add$payment );
  226.             $payment->setEleve$this );
  227.         }
  228.         return $this;
  229.     }
  230.     public function removePaymentPayment $payment ): self
  231.  {
  232.         if ( $this->payments->removeElement$payment ) ) {
  233.             // set the owning side to null ( unless already changed )
  234.             if ( $payment->getEleve() === $this ) {
  235.                 $payment->setElevenull );
  236.             }
  237.         }
  238.         return $this;
  239.     }
  240.     public function isIsPremium(): ?bool
  241.  {
  242.         return $this->isPremium;
  243.     }
  244.     public function setIsPremium( ?bool $isPremium ): self
  245.  {
  246.         $this->isPremium $isPremium;
  247.         return $this;
  248.     }
  249.     /**
  250.     * @return Collection<int, Lecture>
  251.     */
  252.     public function getLectures(): Collection
  253.  {
  254.         return $this->lectures;
  255.     }
  256.     public function addLectureLecture $lecture ): self
  257.  {
  258.         if ( !$this->lectures->contains$lecture ) ) {
  259.             $this->lectures->add$lecture );
  260.             $lecture->setEleve$this );
  261.         }
  262.         return $this;
  263.     }
  264.     public function removeLectureLecture $lecture ): self
  265.  {
  266.         if ( $this->lectures->removeElement$lecture ) ) {
  267.             // set the owning side to null ( unless already changed )
  268.             if ( $lecture->getEleve() === $this ) {
  269.                 $lecture->setElevenull );
  270.             }
  271.         }
  272.         return $this;
  273.     }
  274.     /**
  275.     * @return Collection<int, QuizResult>
  276.     */
  277.     public function getQuizResults(): Collection
  278.  {
  279.         return $this->quizResults;
  280.     }
  281.     public function addQuizResultQuizResult $quizResult ): self
  282.  {
  283.         if ( !$this->quizResults->contains$quizResult ) ) {
  284.             $this->quizResults->add$quizResult );
  285.             $quizResult->setEleve$this );
  286.         }
  287.         return $this;
  288.     }
  289.     public function removeQuizResultQuizResult $quizResult ): self
  290.  {
  291.         if ( $this->quizResults->removeElement$quizResult ) ) {
  292.             // set the owning side to null ( unless already changed )
  293.             if ( $quizResult->getEleve() === $this ) {
  294.                 $quizResult->setElevenull );
  295.             }
  296.         }
  297.         return $this;
  298.     }
  299.     /**
  300.     * @return Collection<int, QuizLost>
  301.     */
  302.     public function getQuizLosts(): Collection
  303.  {
  304.         return $this->quizLosts;
  305.     }
  306.     public function addQuizLostQuizLost $quizLost ): self
  307.  {
  308.         if ( !$this->quizLosts->contains$quizLost ) ) {
  309.             $this->quizLosts->add$quizLost );
  310.             $quizLost->setEleve$this );
  311.         }
  312.         return $this;
  313.     }
  314.     public function removeQuizLostQuizLost $quizLost ): self
  315.  {
  316.         if ( $this->quizLosts->removeElement$quizLost ) ) {
  317.             // set the owning side to null ( unless already changed )
  318.             if ( $quizLost->getEleve() === $this ) {
  319.                 $quizLost->setElevenull );
  320.             }
  321.         }
  322.         return $this;
  323.     }
  324.     /**
  325.     * @return Collection<int, Evaluation>
  326.     */
  327.     public function getEvaluations(): Collection
  328.  {
  329.         return $this->evaluations;
  330.     }
  331.     public function addEvaluationEvaluation $evaluation ): self
  332.  {
  333.         if ( !$this->evaluations->contains$evaluation ) ) {
  334.             $this->evaluations->add$evaluation );
  335.             $evaluation->addEleve$this );
  336.         }
  337.         return $this;
  338.     }
  339.     public function removeEvaluationEvaluation $evaluation ): self
  340.  {
  341.         if ( $this->evaluations->removeElement$evaluation ) ) {
  342.             $evaluation->removeEleve$this );
  343.         }
  344.         return $this;
  345.     }
  346.     /**
  347.     * @return Collection<int, EvaluationResultat>
  348.     */
  349.     public function getEvaluationResultats(): Collection
  350.  {
  351.         return $this->evaluationResultats;
  352.     }
  353.     public function addEvaluationResultatEvaluationResultat $evaluationResultat ): self
  354.  {
  355.         if ( !$this->evaluationResultats->contains$evaluationResultat ) ) {
  356.             $this->evaluationResultats->add$evaluationResultat );
  357.             $evaluationResultat->setEleve$this );
  358.         }
  359.         return $this;
  360.     }
  361.     public function removeEvaluationResultatEvaluationResultat $evaluationResultat ): self
  362.  {
  363.         if ( $this->evaluationResultats->removeElement$evaluationResultat ) ) {
  364.             // set the owning side to null ( unless already changed )
  365.             if ( $evaluationResultat->getEleve() === $this ) {
  366.                 $evaluationResultat->setElevenull );
  367.             }
  368.         }
  369.         return $this;
  370.     }
  371.     public function getSkillLevel(): ?SkillLevel
  372.     {
  373.         return $this->classe $this->classe->getSkillLevel() : null;
  374.     }
  375.     /**
  376.      * @return Collection<int, SubjectChat>
  377.      */
  378.     public function getSubjectChats(): Collection
  379.     {
  380.         return $this->subjectChats;
  381.     }
  382.     public function addSubjectChat(SubjectChat $subjectChat): static
  383.     {
  384.         if (!$this->subjectChats->contains($subjectChat)) {
  385.             $this->subjectChats->add($subjectChat);
  386.             $subjectChat->setEleve($this);
  387.         }
  388.         return $this;
  389.     }
  390.     public function removeSubjectChat(SubjectChat $subjectChat): static
  391.     {
  392.         if ($this->subjectChats->removeElement($subjectChat)) {
  393.             // set the owning side to null (unless already changed)
  394.             if ($subjectChat->getEleve() === $this) {
  395.                 $subjectChat->setEleve(null);
  396.             }
  397.         }
  398.         return $this;
  399.     }
  400. }