Education.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Education;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use App\Entity\AccessWish\EducationStudentWish;
  6. use App\Entity\Booking\Course;
  7. use App\Entity\Booking\Examen;
  8. use App\Entity\Core\Tagg;
  9. // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14. * Classe ... qui ...
  15. */
  16. #[ApiResource(operations: [])]
  17. // #[Auditable]
  18. #[ORM\Entity]
  19. class Education
  20. {
  21. #[ORM\Id]
  22. #[ORM\Column]
  23. #[ORM\GeneratedValue]
  24. private ?int $id = null;
  25. #[ORM\OneToMany(mappedBy: 'education', targetEntity: EducationCurriculum::class, cascade: ['persist'], orphanRemoval: true)]
  26. private Collection $educationCurriculums;
  27. #[ORM\OneToMany(mappedBy: 'education', targetEntity: CycleByEducation::class, cascade: ['persist'], orphanRemoval: true)]
  28. private Collection $cycleByEducations;
  29. #[ORM\ManyToOne(fetch: 'EAGER', inversedBy: 'educations')]
  30. #[ORM\JoinColumn(nullable: false)]
  31. private EducationCategory $educationCategory;
  32. #[ORM\ManyToOne(fetch: 'EAGER')]
  33. #[ORM\JoinColumn(nullable: false)]
  34. private EducationComplement $educationComplement;
  35. #[ORM\OneToMany(mappedBy: 'education', targetEntity: Course::class)]
  36. private Collection $courses;
  37. #[ORM\OneToMany(mappedBy: 'education', targetEntity: Examen::class)]
  38. private Collection $examens;
  39. #[ORM\OneToMany(mappedBy: 'education', targetEntity: EducationTeacher::class, orphanRemoval: true)]
  40. private Collection $educationTeachers;
  41. #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'educations', cascade: ['persist'])]
  42. #[ORM\JoinTable(name: 'tag_education')]
  43. #[ORM\JoinColumn(name: 'education_id', referencedColumnName: 'id')]
  44. #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  45. private Collection $tags;
  46. #[ORM\ManyToOne]
  47. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  48. private EducationNotationConfig $educationNotationConfig;
  49. #[ORM\OneToMany(mappedBy: 'educationWish', targetEntity: EducationStudentWish::class, cascade: [], orphanRemoval: true)]
  50. protected Collection $educationWishes;
  51. public function __construct()
  52. {
  53. $this->educationCurriculums = new ArrayCollection();
  54. $this->cycleByEducations = new ArrayCollection();
  55. $this->courses = new ArrayCollection();
  56. $this->examens = new ArrayCollection();
  57. $this->educationTeachers = new ArrayCollection();
  58. $this->tags = new ArrayCollection();
  59. $this->educationWishes = new ArrayCollection();
  60. }
  61. public function getId(): ?int
  62. {
  63. return $this->id;
  64. }
  65. /**
  66. * @return Collection<int, EducationCurriculum>
  67. */
  68. public function getEducationCurriculums(): Collection
  69. {
  70. return $this->educationCurriculums;
  71. }
  72. public function addEducationCurriculum(EducationCurriculum $educationCurriculum): self
  73. {
  74. if (!$this->educationCurriculums->contains($educationCurriculum)) {
  75. $this->educationCurriculums[] = $educationCurriculum;
  76. $educationCurriculum->setEducation($this);
  77. }
  78. return $this;
  79. }
  80. public function removeEducationCurriculum(EducationCurriculum $educationCurriculum): self
  81. {
  82. if ($this->educationCurriculums->removeElement($educationCurriculum)) {
  83. // set the owning side to null (unless already changed)
  84. if ($educationCurriculum->getEducation() === $this) {
  85. $educationCurriculum->setEducation(null);
  86. }
  87. }
  88. return $this;
  89. }
  90. /**
  91. * @return Collection<int, CycleByEducation>
  92. */
  93. public function getCycleByEducations(): Collection
  94. {
  95. return $this->cycleByEducations;
  96. }
  97. public function addCycleByEducation(CycleByEducation $cycleByEducation): self
  98. {
  99. if (!$this->cycleByEducations->contains($cycleByEducation)) {
  100. $this->cycleByEducations[] = $cycleByEducation;
  101. $cycleByEducation->setEducation($this);
  102. }
  103. return $this;
  104. }
  105. public function removeCycleByEducation(CycleByEducation $cycleByEducation): self
  106. {
  107. if ($this->cycleByEducations->removeElement($cycleByEducation)) {
  108. // set the owning side to null (unless already changed)
  109. if ($cycleByEducation->getEducation() === $this) {
  110. $cycleByEducation->setEducation(null);
  111. }
  112. }
  113. return $this;
  114. }
  115. public function getEducationCategory(): ?EducationCategory
  116. {
  117. return $this->educationCategory;
  118. }
  119. public function setEducationCategory(?EducationCategory $educationCategory): self
  120. {
  121. $this->educationCategory = $educationCategory;
  122. return $this;
  123. }
  124. public function getEducationComplement(): ?EducationComplement
  125. {
  126. return $this->educationComplement;
  127. }
  128. public function setEducationComplement(?EducationComplement $educationComplement): self
  129. {
  130. $this->educationComplement = $educationComplement;
  131. return $this;
  132. }
  133. /**
  134. * @return Collection<int, Course>
  135. */
  136. public function getCourses(): Collection
  137. {
  138. return $this->courses;
  139. }
  140. public function addCourse(Course $course): self
  141. {
  142. if (!$this->courses->contains($course)) {
  143. $this->courses[] = $course;
  144. $course->setEducation($this);
  145. }
  146. return $this;
  147. }
  148. public function removeCourse(Course $course): self
  149. {
  150. if ($this->courses->removeElement($course)) {
  151. // set the owning side to null (unless already changed)
  152. if ($course->getEducation() === $this) {
  153. $course->setEducation(null);
  154. }
  155. }
  156. return $this;
  157. }
  158. /**
  159. * @return Collection<int, Examen>
  160. */
  161. public function getExamens(): Collection
  162. {
  163. return $this->examens;
  164. }
  165. public function addExamen(Examen $examen): self
  166. {
  167. if (!$this->examens->contains($examen)) {
  168. $this->examens[] = $examen;
  169. $examen->setEducation($this);
  170. }
  171. return $this;
  172. }
  173. public function removeExamen(Examen $examen): self
  174. {
  175. if ($this->examens->removeElement($examen)) {
  176. // set the owning side to null (unless already changed)
  177. if ($examen->getEducation() === $this) {
  178. $examen->setEducation(null);
  179. }
  180. }
  181. return $this;
  182. }
  183. /**
  184. * @return Collection<int, EducationTeacher>
  185. */
  186. public function getEducationTeachers(): Collection
  187. {
  188. return $this->educationTeachers;
  189. }
  190. public function addEducationTeacher(EducationTeacher $educationTeacher): self
  191. {
  192. if (!$this->educationTeachers->contains($educationTeacher)) {
  193. $this->educationTeachers[] = $educationTeacher;
  194. $educationTeacher->setEducation($this);
  195. }
  196. return $this;
  197. }
  198. public function removeEducationTeacher(EducationTeacher $educationTeacher): self
  199. {
  200. if ($this->educationTeachers->removeElement($educationTeacher)) {
  201. // set the owning side to null (unless already changed)
  202. if ($educationTeacher->getEducation() === $this) {
  203. $educationTeacher->setEducation(null);
  204. }
  205. }
  206. return $this;
  207. }
  208. /**
  209. * @return Collection<int, Tagg>
  210. */
  211. public function getTags(): Collection
  212. {
  213. return $this->tags;
  214. }
  215. public function addTag(Tagg $tag): self
  216. {
  217. if (!$this->tags->contains($tag)) {
  218. $this->tags[] = $tag;
  219. }
  220. return $this;
  221. }
  222. public function removeTag(Tagg $tag): self
  223. {
  224. $this->tags->removeElement($tag);
  225. return $this;
  226. }
  227. public function getEducationNotationConfig(): ?EducationNotationConfig
  228. {
  229. return $this->educationNotationConfig;
  230. }
  231. public function setEducationNotationConfig(?EducationNotationConfig $educationNotationConfig): self
  232. {
  233. $this->educationNotationConfig = $educationNotationConfig;
  234. return $this;
  235. }
  236. function getEducationWishes(): Collection
  237. {
  238. return $this->educationWishes;
  239. }
  240. function addEducationWishe(EducationStudentWish $educationWishe): self
  241. {
  242. if (!$this->educationWishes->contains($educationWishe)) {
  243. $this->educationWishes[] = $educationWishe;
  244. }
  245. return $this;
  246. }
  247. function removeEducationWishe(EducationStudentWish $educationWishe): self
  248. {
  249. $this->educationWishes->removeElement($educationWishe);
  250. return $this;
  251. }
  252. }