src/Entity/ParentNote.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\ParentNoteRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use JMS\Serializer\Annotation\Groups;
  9. #[ORM\HasLifecycleCallbacks]
  10. #[ORM\Entity(repositoryClassParentNoteRepository::class)]
  11. class ParentNote
  12. {
  13.     use Timestampable;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     #[Groups(['note'])]
  18.     private ?int $id null;
  19.     #[ORM\Column(length255)]
  20.     #[Groups(['note'])]
  21.     private ?string $name null;
  22.     // Nullable : un ParentNote du système "par compétence" est rattaché à une
  23.     // Competence, pas à un Exams (séquence) — exam et competence sont
  24.     // mutuellement exclusifs selon le système d'évaluation de la classe.
  25.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  26.     private ?Exams $exam null;
  27.     #[ORM\ManyToOne]
  28.     private ?Competence $competence null;
  29.     #[ORM\OneToMany(mappedBy'parentNote'targetEntityNote::class, orphanRemovaltrue)]
  30.     private Collection $note;
  31.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  32.     #[ORM\JoinColumn(nullablefalse)]
  33.     private ?Subject $subject null;
  34.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  35.     #[ORM\JoinColumn(nullablefalse)]
  36.     private ?School $school null;
  37.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  38.     #[ORM\JoinColumn(nullablefalse)]
  39.     #[Groups(['note'])]
  40.     private ?SchoolYear $year null;
  41.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  42.     #[ORM\JoinColumn(nullablefalse)]
  43.     private ?TheClass $classe null;
  44.     #[ORM\Column(nullabletrue)]
  45.     #[Groups(['note'])]
  46.     private ?int $dividend null;
  47.     public function __construct()
  48.     {
  49.         $this->note = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getName(): ?string
  56.     {
  57.         return $this->name;
  58.     }
  59.     public function setName(string $name): static
  60.     {
  61.         $this->name $name;
  62.         return $this;
  63.     }
  64.     public function getExam(): ?Exams
  65.     {
  66.         return $this->exam;
  67.     }
  68.     public function setExam(?Exams $exam): static
  69.     {
  70.         $this->exam $exam;
  71.         return $this;
  72.     }
  73.     public function getCompetence(): ?Competence
  74.     {
  75.         return $this->competence;
  76.     }
  77.     public function setCompetence(?Competence $competence): static
  78.     {
  79.         $this->competence $competence;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, Note>
  84.      */
  85.     public function getNotes(): Collection
  86.     {
  87.         return $this->note;
  88.     }
  89.     public function addNote(Note $note): static
  90.     {
  91.         if (!$this->note->contains($note)) {
  92.             $this->note->add($note);
  93.             $note->setParentNote($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeNote(Note $note): static
  98.     {
  99.         if ($this->note->removeElement($note)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($note->getParentNote() === $this) {
  102.                 $note->setParentNote(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     public function getSubject(): ?Subject
  108.     {
  109.         return $this->subject;
  110.     }
  111.     public function setSubject(?Subject $subject): static
  112.     {
  113.         $this->subject $subject;
  114.         return $this;
  115.     }
  116.     public function getSchool(): ?School
  117.     {
  118.         return $this->school;
  119.     }
  120.     public function setSchool(?School $school): static
  121.     {
  122.         $this->school $school;
  123.         return $this;
  124.     }
  125.     public function getYear(): ?SchoolYear
  126.     {
  127.         return $this->year;
  128.     }
  129.     public function setYear(?SchoolYear $year): static
  130.     {
  131.         $this->year $year;
  132.         return $this;
  133.     }
  134.     public function getClasse(): ?TheClass
  135.     {
  136.         return $this->classe;
  137.     }
  138.     public function setClasse(?TheClass $classe): static
  139.     {
  140.         $this->classe $classe;
  141.         return $this;
  142.     }
  143.     public function getDividend(): ?int
  144.     {
  145.         return $this->dividend;
  146.     }
  147.     public function setDividend(?int $dividend): static
  148.     {
  149.         $this->dividend $dividend;
  150.         return $this;
  151.     }
  152. }