src/Entity/Note.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\Timestampable;
  4. use App\Repository\NoteRepository;
  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(repositoryClassNoteRepository::class)]
  11. #[ORM\UniqueConstraint(columns: ['student_id''subject_id''exams_id''parent_note_id'])]
  12. class Note
  13. {
  14.     use Timestampable;
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column]
  18.     #[Groups(['note','getBulletin'])]
  19.     private ?int $id null;
  20.     #[ORM\Column]
  21.     #[Groups(['note','getBulletin'])]
  22.     private ?float $note null;
  23.     #[ORM\Column]
  24.     #[Groups(['note','getBulletin'])]
  25.     private ?float $noteCoef null;
  26.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  27.     #[Groups(['note'])]
  28.     private ?Student $student null;
  29.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  30.     #[Groups(['note'])]
  31.     private ?Exams $exams null;
  32.     // Système par compétence : remplace exams comme unité de notation (mutuellement
  33.     // exclusifs selon TheClassEvaluationSystem de la classe).
  34.     #[ORM\ManyToOne]
  35.     #[Groups(['note'])]
  36.     private ?Competence $competence null;
  37.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  38.     #[Groups(['note'])]
  39.     private ?TheClass $classe null;
  40.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  41.     #[ORM\JoinColumn(nullablefalse)]
  42.     #[Groups(['note','getBulletin'])]
  43.     private ?Subject $subject null;
  44.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  45.     #[ORM\JoinColumn(nullablefalse)]
  46.     #[Groups(['note','getBulletin'])]
  47.     private ?SchoolYear $year null;
  48.     #[ORM\Column(length255nullabletrue)]
  49.     #[Groups(['note'])]
  50.     private ?string $examName null;
  51.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  52.     #[ORM\JoinColumn(nullablefalse)]
  53.     private ?User $author null;
  54.     #[ORM\ManyToOne(inversedBy'notesEdited'cascade: ["persist"])]
  55.     private ?User $editor null;
  56.     #[ORM\ManyToOne(inversedBy'notes'cascade: ["persist"])]
  57.     private ?School $school null;
  58.     #[ORM\ManyToOne(inversedBy'notes')]
  59.     private ?SubSequence $subSequence null;
  60.     #[ORM\Column(length255nullabletrue)]
  61.     #[Groups(['note'])]
  62.     private ?string $name null;
  63.     #[ORM\ManyToOne(inversedBy'note')]
  64.     #[Groups(['note'])]
  65.     private ?ParentNote $parentNote null;
  66.     #[ORM\Column(nullabletrue)]
  67.     private ?int $division null;
  68.     #[ORM\Column(nullabletrue)]
  69.     #[Groups(['note'])]
  70.     private ?int $dividend null;
  71.     #[ORM\OneToMany(mappedBy'parent'targetEntitySubNote::class)]
  72.     private Collection $subNotes;
  73.     public function __construct()
  74.     {
  75.         $this->subNotes = new ArrayCollection();
  76.     }
  77.     public function getId(): ?int
  78.     {
  79.         return $this->id;
  80.     }
  81.     public function getNote(): ?float
  82.     {
  83.         return $this->note;
  84.     }
  85.     public function setNote(float $note): static
  86.     {
  87.         $this->note $note;
  88.         return $this;
  89.     }
  90.     public function getNoteCoef(): ?float
  91.     {
  92.         return $this->noteCoef;
  93.     }
  94.     public function setNoteCoef(float $noteCoef): static
  95.     {
  96.         $this->noteCoef $noteCoef;
  97.         return $this;
  98.     }
  99.     public function getStudent(): ?Student
  100.     {
  101.         return $this->student;
  102.     }
  103.     public function setStudent(?Student $student): static
  104.     {
  105.         $this->student $student;
  106.         return $this;
  107.     }
  108.     public function getExams(): ?Exams
  109.     {
  110.         return $this->exams;
  111.     }
  112.     public function setExams(?Exams $exams): static
  113.     {
  114.         $this->exams $exams;
  115.         return $this;
  116.     }
  117.     public function getCompetence(): ?Competence
  118.     {
  119.         return $this->competence;
  120.     }
  121.     public function setCompetence(?Competence $competence): static
  122.     {
  123.         $this->competence $competence;
  124.         return $this;
  125.     }
  126.     public function getClasse(): ?TheClass
  127.     {
  128.         return $this->classe;
  129.     }
  130.     public function setClasse(?TheClass $classe): static
  131.     {
  132.         $this->classe $classe;
  133.         return $this;
  134.     }
  135.     public function getSubject(): ?Subject
  136.     {
  137.         return $this->subject;
  138.     }
  139.     public function setSubject(?Subject $subject): static
  140.     {
  141.         $this->subject $subject;
  142.         return $this;
  143.     }
  144.     public function getYear(): ?SchoolYear
  145.     {
  146.         return $this->year;
  147.     }
  148.     public function setYear(?SchoolYear $year): static
  149.     {
  150.         $this->year $year;
  151.         return $this;
  152.     }
  153.     public function getExamName(): ?string
  154.     {
  155.         return $this->examName;
  156.     }
  157.     public function setExamName(?string $examName): static
  158.     {
  159.         $this->examName $examName;
  160.         return $this;
  161.     }
  162.     public function getRelation(): ?string
  163.     {
  164.         return $this->relation;
  165.     }
  166.     public function setRelation(string $relation): static
  167.     {
  168.         $this->relation $relation;
  169.         return $this;
  170.     }
  171.     public function getAuthor(): ?User
  172.     {
  173.         return $this->author;
  174.     }
  175.     public function setAuthor(?User $author): static
  176.     {
  177.         $this->author $author;
  178.         return $this;
  179.     }
  180.     public function getEditor(): ?User
  181.     {
  182.         return $this->editor;
  183.     }
  184.     public function setEditor(?User $editor): static
  185.     {
  186.         $this->editor $editor;
  187.         return $this;
  188.     }
  189.     public function getSchool(): ?School
  190.     {
  191.         return $this->school;
  192.     }
  193.     public function setSchool(?School $school): static
  194.     {
  195.         $this->school $school;
  196.         return $this;
  197.     }
  198.     public function getSubSequence(): ?SubSequence
  199.     {
  200.         return $this->subSequence;
  201.     }
  202.     public function setSubSequence(?SubSequence $subSequence): static
  203.     {
  204.         $this->subSequence $subSequence;
  205.         return $this;
  206.     }
  207.     public function getName(): ?string
  208.     {
  209.         return $this->name;
  210.     }
  211.     public function setName(?string $name): static
  212.     {
  213.         $this->name $name;
  214.         return $this;
  215.     }
  216.     /**
  217.      * @return Collection<int, SubNote>
  218.      */
  219.     public function getSubNotes(): Collection
  220.     {
  221.         return $this->subNotes;
  222.     }
  223.     public function addSubNote(SubNote $subNote): static
  224.     {
  225.         if (!$this->subNotes->contains($subNote)) {
  226.             $this->subNotes->add($subNote);
  227.             $subNote->setParent($this);
  228.         }
  229.         return $this;
  230.     }
  231.     public function getParentNote(): ?ParentNote
  232.     {
  233.         return $this->parentNote;
  234.     }
  235.     public function setParentNote(?ParentNote $parentNote): static
  236.     {
  237.         $this->parentNote $parentNote;
  238.         return $this;
  239.     }
  240.     public function getDivision(): ?int
  241.     {
  242.         return $this->division;
  243.     }
  244.     public function setDivision(?int $division): static
  245.     {
  246.         $this->division $division;
  247.         return $this;
  248.     }
  249.     public function getDividend(): ?int
  250.     {
  251.         return $this->dividend;
  252.     }
  253.     public function setDividend(?int $dividend): static
  254.     {
  255.         $this->dividend $dividend;
  256.         return $this;
  257.     }
  258.     public function removeSubNote(SubNote $subNote): static
  259.     {
  260.         if ($this->subNotes->removeElement($subNote)) {
  261.             // set the owning side to null (unless already changed)
  262.             if ($subNote->getParent() === $this) {
  263.                 $subNote->setParent(null);
  264.             }
  265.         }
  266.         return $this;
  267.     }
  268. }