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