Education.php 7.8 KB

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