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