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