EducationStudent.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\Entity\Education;
  4. use ApiPlatform\Metadata\Get;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use App\Entity\Access\Access;
  7. use App\Entity\Core\Tagg;
  8. //use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. /**
  13. * Classe ... qui ...
  14. */
  15. #[ApiResource(operations: [])]
  16. //#[Auditable]
  17. #[ORM\Entity]
  18. class EducationStudent
  19. {
  20. #[ORM\Id]
  21. #[ORM\Column]
  22. #[ORM\GeneratedValue]
  23. private ?int $id = null;
  24. #[ORM\ManyToOne(cascade: ['persist'], inversedBy: 'educationStudent')]
  25. #[ORM\JoinColumn(nullable: false)]
  26. private Access $access;
  27. #[ORM\ManyToOne(inversedBy: 'educationStudent')]
  28. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  29. private EducationCurriculum $educationCurriculum;
  30. #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'educationStudentByTeacher')]
  31. #[ORM\JoinTable(name: 'educationstudent_teacher')]
  32. private Collection $teachers;
  33. #[ORM\OneToMany(mappedBy: 'educationStudent', targetEntity: EducationNotation::class, cascade: ['persist'], orphanRemoval: true)]
  34. private Collection $educationNotations;
  35. #[ORM\ManyToOne(inversedBy: 'referencedEducationStudent')]
  36. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  37. private EducationStudent $educationStudentLastYear;
  38. #[ORM\OneToMany(mappedBy: 'educationStudentLastYear', targetEntity: EducationStudent::class)]
  39. protected Collection $referencedEducationStudent;
  40. #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educationStudents', cascade: ['persist'])]
  41. #[ORM\JoinTable(name: 'tag_educationStudent')]
  42. #[ORM\JoinColumn(name: 'educationStudent_id', referencedColumnName: 'id')]
  43. #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  44. private Collection $tags;
  45. #[ORM\ManyToOne(inversedBy: 'educationStudents')]
  46. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  47. private EducationTiming $educationTiming;
  48. public function __construct()
  49. {
  50. $this->teachers = new ArrayCollection();
  51. $this->educationNotations = new ArrayCollection();
  52. $this->referencedEducationStudent = new ArrayCollection();
  53. $this->tags = new ArrayCollection();
  54. }
  55. public function getId(): ?int
  56. {
  57. return $this->id;
  58. }
  59. public function getAccess(): ?Access
  60. {
  61. return $this->access;
  62. }
  63. public function setAccess(?Access $access): self
  64. {
  65. $this->access = $access;
  66. return $this;
  67. }
  68. public function getEducationCurriculum(): ?EducationCurriculum
  69. {
  70. return $this->educationCurriculum;
  71. }
  72. public function setEducationCurriculum(?EducationCurriculum $educationCurriculum): self
  73. {
  74. $this->educationCurriculum = $educationCurriculum;
  75. return $this;
  76. }
  77. /**
  78. * @return Collection<int, Access>
  79. */
  80. public function getTeachers(): Collection
  81. {
  82. return $this->teachers;
  83. }
  84. public function addTeacher(Access $teacher): self
  85. {
  86. if (!$this->teachers->contains($teacher)) {
  87. $this->teachers[] = $teacher;
  88. }
  89. return $this;
  90. }
  91. public function removeTeacher(Access $teacher): self
  92. {
  93. $this->teachers->removeElement($teacher);
  94. return $this;
  95. }
  96. /**
  97. * @return Collection<int, EducationNotation>
  98. */
  99. public function getEducationNotations(): Collection
  100. {
  101. return $this->educationNotations;
  102. }
  103. public function addEducationNotation(EducationNotation $educationNotation): self
  104. {
  105. if (!$this->educationNotations->contains($educationNotation)) {
  106. $this->educationNotations[] = $educationNotation;
  107. $educationNotation->setEducationStudent($this);
  108. }
  109. return $this;
  110. }
  111. public function removeEducationNotation(EducationNotation $educationNotation): self
  112. {
  113. if ($this->educationNotations->removeElement($educationNotation)) {
  114. // set the owning side to null (unless already changed)
  115. if ($educationNotation->getEducationStudent() === $this) {
  116. $educationNotation->setEducationStudent(null);
  117. }
  118. }
  119. return $this;
  120. }
  121. public function getEducationStudentLastYear(): ?self
  122. {
  123. return $this->educationStudentLastYear;
  124. }
  125. public function setEducationStudentLastYear(?self $educationStudentLastYear): self
  126. {
  127. $this->educationStudentLastYear = $educationStudentLastYear;
  128. return $this;
  129. }
  130. /**
  131. * @return Collection<int, EducationStudent>
  132. */
  133. public function getReferencedEducationStudent(): Collection
  134. {
  135. return $this->referencedEducationStudent;
  136. }
  137. public function addReferencedEducationStudent(EducationStudent $referencedEducationStudent): self
  138. {
  139. if (!$this->referencedEducationStudent->contains($referencedEducationStudent)) {
  140. $this->referencedEducationStudent[] = $referencedEducationStudent;
  141. $referencedEducationStudent->setEducationStudentLastYear($this);
  142. }
  143. return $this;
  144. }
  145. public function removeReferencedEducationStudent(EducationStudent $referencedEducationStudent): self
  146. {
  147. if ($this->referencedEducationStudent->removeElement($referencedEducationStudent)) {
  148. // set the owning side to null (unless already changed)
  149. if ($referencedEducationStudent->getEducationStudentLastYear() === $this) {
  150. $referencedEducationStudent->setEducationStudentLastYear(null);
  151. }
  152. }
  153. return $this;
  154. }
  155. /**
  156. * @return Collection<int, Tagg>
  157. */
  158. public function getTags(): Collection
  159. {
  160. return $this->tags;
  161. }
  162. public function addTag(Tagg $tag): self
  163. {
  164. if (!$this->tags->contains($tag)) {
  165. $this->tags[] = $tag;
  166. }
  167. return $this;
  168. }
  169. public function removeTag(Tagg $tag): self
  170. {
  171. $this->tags->removeElement($tag);
  172. return $this;
  173. }
  174. public function getEducationTiming(): ?EducationTiming
  175. {
  176. return $this->educationTiming;
  177. }
  178. public function setEducationTiming(?EducationTiming $educationTiming): self
  179. {
  180. $this->educationTiming = $educationTiming;
  181. return $this;
  182. }
  183. }