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.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private ?Exams $exam null;
  25.     #[ORM\OneToMany(mappedBy'parentNote'targetEntityNote::class, orphanRemovaltrue)]
  26.     private Collection $note;
  27.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     private ?Subject $subject null;
  30.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  31.     #[ORM\JoinColumn(nullablefalse)]
  32.     private ?School $school null;
  33.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  34.     #[ORM\JoinColumn(nullablefalse)]
  35.     private ?SchoolYear $year null;
  36.     #[ORM\ManyToOne(inversedBy'parentNotes')]
  37.     #[ORM\JoinColumn(nullablefalse)]
  38.     private ?TheClass $classe null;
  39.     #[ORM\Column(nullabletrue)]
  40.     #[Groups(['note'])]
  41.     private ?int $dividend null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?float $coef null;
  44.     public function __construct()
  45.     {
  46.         $this->note = new ArrayCollection();
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getName(): ?string
  53.     {
  54.         return $this->name;
  55.     }
  56.     public function setName(string $name): static
  57.     {
  58.         $this->name $name;
  59.         return $this;
  60.     }
  61.     public function getExam(): ?Exams
  62.     {
  63.         return $this->exam;
  64.     }
  65.     public function setExam(?Exams $exam): static
  66.     {
  67.         $this->exam $exam;
  68.         return $this;
  69.     }
  70.     /**
  71.      * @return Collection<int, Note>
  72.      */
  73.     public function getNotes(): Collection
  74.     {
  75.         return $this->note;
  76.     }
  77.     public function addNote(Note $note): static
  78.     {
  79.         if (!$this->note->contains($note)) {
  80.             $this->note->add($note);
  81.             $note->setParentNote($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeNote(Note $note): static
  86.     {
  87.         if ($this->note->removeElement($note)) {
  88.             // set the owning side to null (unless already changed)
  89.             if ($note->getParentNote() === $this) {
  90.                 $note->setParentNote(null);
  91.             }
  92.         }
  93.         return $this;
  94.     }
  95.     public function getSubject(): ?Subject
  96.     {
  97.         return $this->subject;
  98.     }
  99.     public function setSubject(?Subject $subject): static
  100.     {
  101.         $this->subject $subject;
  102.         return $this;
  103.     }
  104.     public function getSchool(): ?School
  105.     {
  106.         return $this->school;
  107.     }
  108.     public function setSchool(?School $school): static
  109.     {
  110.         $this->school $school;
  111.         return $this;
  112.     }
  113.     public function getYear(): ?SchoolYear
  114.     {
  115.         return $this->year;
  116.     }
  117.     public function setYear(?SchoolYear $year): static
  118.     {
  119.         $this->year $year;
  120.         return $this;
  121.     }
  122.     public function getClasse(): ?TheClass
  123.     {
  124.         return $this->classe;
  125.     }
  126.     public function setClasse(?TheClass $classe): static
  127.     {
  128.         $this->classe $classe;
  129.         return $this;
  130.     }
  131.     public function getDividend(): ?int
  132.     {
  133.         return $this->dividend;
  134.     }
  135.     public function setDividend(?int $dividend): static
  136.     {
  137.         $this->dividend $dividend;
  138.         return $this;
  139.     }
  140.     public function getCoef(): ?float
  141.     {
  142.         return $this->coef;
  143.     }
  144.     public function setCoef(?float $coef): static
  145.     {
  146.         $this->coef $coef;
  147.         return $this;
  148.     }
  149. }