EducationStudent.php 7.1 KB

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