Education.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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. }
  60. public function getId(): ?int
  61. {
  62. return $this->id;
  63. }
  64. /**
  65. * @return Collection<int, EducationCurriculum>
  66. */
  67. public function getEducationCurriculums(): Collection
  68. {
  69. return $this->educationCurriculums;
  70. }
  71. public function addEducationCurriculum(EducationCurriculum $educationCurriculum): self
  72. {
  73. if (!$this->educationCurriculums->contains($educationCurriculum)) {
  74. $this->educationCurriculums[] = $educationCurriculum;
  75. $educationCurriculum->setEducation($this);
  76. }
  77. return $this;
  78. }
  79. public function removeEducationCurriculum(EducationCurriculum $educationCurriculum): self
  80. {
  81. if ($this->educationCurriculums->removeElement($educationCurriculum)) {
  82. // set the owning side to null (unless already changed)
  83. if ($educationCurriculum->getEducation() === $this) {
  84. $educationCurriculum->setEducation(null);
  85. }
  86. }
  87. return $this;
  88. }
  89. /**
  90. * @return Collection<int, CycleByEducation>
  91. */
  92. public function getCycleByEducations(): Collection
  93. {
  94. return $this->cycleByEducations;
  95. }
  96. public function addCycleByEducation(CycleByEducation $cycleByEducation): self
  97. {
  98. if (!$this->cycleByEducations->contains($cycleByEducation)) {
  99. $this->cycleByEducations[] = $cycleByEducation;
  100. $cycleByEducation->setEducation($this);
  101. }
  102. return $this;
  103. }
  104. public function removeCycleByEducation(CycleByEducation $cycleByEducation): self
  105. {
  106. if ($this->cycleByEducations->removeElement($cycleByEducation)) {
  107. // set the owning side to null (unless already changed)
  108. if ($cycleByEducation->getEducation() === $this) {
  109. $cycleByEducation->setEducation(null);
  110. }
  111. }
  112. return $this;
  113. }
  114. public function getEducationCategory(): ?EducationCategory
  115. {
  116. return $this->educationCategory;
  117. }
  118. public function setEducationCategory(?EducationCategory $educationCategory): self
  119. {
  120. $this->educationCategory = $educationCategory;
  121. return $this;
  122. }
  123. public function getEducationComplement(): ?EducationComplement
  124. {
  125. return $this->educationComplement;
  126. }
  127. public function setEducationComplement(?EducationComplement $educationComplement): self
  128. {
  129. $this->educationComplement = $educationComplement;
  130. return $this;
  131. }
  132. /**
  133. * @return Collection<int, Course>
  134. */
  135. public function getCourses(): Collection
  136. {
  137. return $this->courses;
  138. }
  139. public function addCourse(Course $course): self
  140. {
  141. if (!$this->courses->contains($course)) {
  142. $this->courses[] = $course;
  143. $course->setEducation($this);
  144. }
  145. return $this;
  146. }
  147. public function removeCourse(Course $course): self
  148. {
  149. if ($this->courses->removeElement($course)) {
  150. // set the owning side to null (unless already changed)
  151. if ($course->getEducation() === $this) {
  152. $course->setEducation(null);
  153. }
  154. }
  155. return $this;
  156. }
  157. /**
  158. * @return Collection<int, Examen>
  159. */
  160. public function getExamens(): Collection
  161. {
  162. return $this->examens;
  163. }
  164. public function addExamen(Examen $examen): self
  165. {
  166. if (!$this->examens->contains($examen)) {
  167. $this->examens[] = $examen;
  168. $examen->setEducation($this);
  169. }
  170. return $this;
  171. }
  172. public function removeExamen(Examen $examen): self
  173. {
  174. if ($this->examens->removeElement($examen)) {
  175. // set the owning side to null (unless already changed)
  176. if ($examen->getEducation() === $this) {
  177. $examen->setEducation(null);
  178. }
  179. }
  180. return $this;
  181. }
  182. /**
  183. * @return Collection<int, EducationTeacher>
  184. */
  185. public function getEducationTeachers(): Collection
  186. {
  187. return $this->educationTeachers;
  188. }
  189. public function addEducationTeacher(EducationTeacher $educationTeacher): self
  190. {
  191. if (!$this->educationTeachers->contains($educationTeacher)) {
  192. $this->educationTeachers[] = $educationTeacher;
  193. $educationTeacher->setEducation($this);
  194. }
  195. return $this;
  196. }
  197. public function removeEducationTeacher(EducationTeacher $educationTeacher): self
  198. {
  199. if ($this->educationTeachers->removeElement($educationTeacher)) {
  200. // set the owning side to null (unless already changed)
  201. if ($educationTeacher->getEducation() === $this) {
  202. $educationTeacher->setEducation(null);
  203. }
  204. }
  205. return $this;
  206. }
  207. /**
  208. * @return Collection<int, Tagg>
  209. */
  210. public function getTags(): Collection
  211. {
  212. return $this->tags;
  213. }
  214. public function addTag(Tagg $tag): self
  215. {
  216. if (!$this->tags->contains($tag)) {
  217. $this->tags[] = $tag;
  218. }
  219. return $this;
  220. }
  221. public function removeTag(Tagg $tag): self
  222. {
  223. $this->tags->removeElement($tag);
  224. return $this;
  225. }
  226. public function getEducationNotationConfig(): ?EducationNotationConfig
  227. {
  228. return $this->educationNotationConfig;
  229. }
  230. public function setEducationNotationConfig(?EducationNotationConfig $educationNotationConfig): self
  231. {
  232. $this->educationNotationConfig = $educationNotationConfig;
  233. return $this;
  234. }
  235. function getEducationWishes(): Collection
  236. {
  237. return $this->educationWishes;
  238. }
  239. function setEducationWishes(Collection $educationWishes): self
  240. {
  241. $this->educationWishes = $educationWishes;
  242. return $this;
  243. }
  244. }