Cycle.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <?php
  2. namespace AppBundle\Entity\Education;
  3. use AppBundle\Entity\Organization\Organization;
  4. use AppBundle\Annotation\DefaultField;
  5. use AppBundle\Enum\Cycle\CycleEnum;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Dunglas\ApiBundle\Annotation\Iri;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use AppBundle\Entity\Traits\TimestampableEntity;
  12. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  13. /**
  14. * Enum des cycles édcatifs, utilisés par les EducationCurriculum
  15. * NB: le nombre de cycles est fixé à 6, mais chaque Organization peut en modifier le label
  16. *
  17. * @Iri("http://schema.org/Cycle")
  18. */
  19. #[ORM\Entity]
  20. class Cycle
  21. {
  22. use TimestampableEntity;
  23. use CreatorUpdaterEntity;
  24. /**
  25. * @var int
  26. */
  27. #[ORM\Column(type: 'integer')]
  28. #[ORM\Id]
  29. #[ORM\GeneratedValue(strategy: 'AUTO')]
  30. #[Groups(['cycle', 'cycle_reference', 'educationcurriculum_reference', 'planning_list', 'access_details_practicalcourses', 'student_list_courses', 'educationstudent_reference_educationcurriculum', 'cycle_read', 'cycle_edit'])]
  31. private $id;
  32. /**
  33. * @var Organization
  34. *
  35. * @DefaultField
  36. */
  37. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'cycles')]
  38. #[ORM\JoinColumn(nullable: false)]
  39. #[Assert\NotNull]
  40. #[Groups(['cycle'])]
  41. private $organization;
  42. /**
  43. * @var integer
  44. */
  45. #[ORM\Column(name: '`order`', type: 'integer', nullable: true)]
  46. #[Assert\Type(type: 'integer', message: 'invalid-integer')]
  47. #[Groups(['cycle'])]
  48. private $order;
  49. /**
  50. * @var string
  51. */
  52. #[ORM\Column(type: 'string')]
  53. #[Assert\Type(type: 'string')]
  54. #[Groups(['cycle', 'educationcurriculum_reference_cycle', 'student_list_educationstudent', 'intangible_list_educationcurriculums', 'my_student_list_educationcurriculum', 'planning_list', 'attendancebooking_list_course', 'generate_attendance', 'report_card_educationstudent', 'access_details_practicalcourses', 'presence_attendance_educationcurriculum', 'student_list_courses', 'examen_details_educationcurriculum', 'course_details_educationcurriculum', 'educationstudent_reference_educationcurriculum', 'cycle_reference', 'access_details_educationstudent', 'edu_stu_courses_courses', 'student_registration_courses', 'educationnotation_list_educationstudent', 'examenconvocation_list_examen', 'accesses_courseteacher_show_practicalcourses', 'education_student_next_year_educationcurriculum', 'education_student_next_year_educationstudentlastyear', 'education_input_list_educationcurriculum', 'access_intangible_list_intangible', 'worksbyusers_db_work', 'educationstudent_notation_educationcurriculum', 'accesses_no_reregistred_list_educationstudent', 'cycle_read', 'cycle_edit'])]
  55. private $label;
  56. /**
  57. * @var string
  58. */
  59. #[ORM\Column(type: 'string')]
  60. #[Assert\Type(type: 'string')]
  61. #[Assert\NotNull]
  62. #[Assert\Choice(callback: ['\AppBundle\Enum\Cycle\CycleEnum', 'toArray'])]
  63. #[Groups(['cycle', 'cycle_read'])]
  64. private $cycleEnum;
  65. /**
  66. * @var bool
  67. */
  68. #[Assert\Type(type: 'boolean')]
  69. #[ORM\Column(type: 'boolean', nullable: true, options: ['default' => false])]
  70. #[Groups(['cycle', 'cycle_read'])]
  71. private $isSystem;
  72. /**
  73. * @var ArrayCollection<CycleByEducation>
  74. */
  75. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Education\CycleByEducation', mappedBy: 'cycle', orphanRemoval: true)]
  76. #[Groups(['cycle_cyclebyeducation'])]
  77. private $cycleByEducations;
  78. /**
  79. * Constructor
  80. */
  81. public function __construct()
  82. {
  83. $this->cycleByEducations = new ArrayCollection();
  84. }
  85. /**
  86. * Sets id.
  87. *
  88. * @param int $id
  89. *
  90. * @return $this
  91. */
  92. public function setId($id)
  93. {
  94. $this->id = $id;
  95. return $this;
  96. }
  97. /**
  98. * Gets id.
  99. *
  100. * @return int
  101. */
  102. public function getId()
  103. {
  104. return $this->id;
  105. }
  106. /**
  107. * Sets organization.
  108. *
  109. * @param Organization $organization
  110. *
  111. * @return $this
  112. */
  113. public function setOrganization(Organization $organization)
  114. {
  115. $this->organization = $organization;
  116. return $this;
  117. }
  118. /**
  119. * Gets organization.
  120. *
  121. * @return Organization
  122. */
  123. public function getOrganization()
  124. {
  125. return $this->organization;
  126. }
  127. /**
  128. * Sets order.
  129. *
  130. * @param integer $order
  131. *
  132. * @return $this
  133. */
  134. public function setOrder($order)
  135. {
  136. $this->order = $order;
  137. return $this;
  138. }
  139. /**
  140. * Gets order.
  141. *
  142. * @return integer
  143. */
  144. public function getOrder()
  145. {
  146. return $this->order;
  147. }
  148. /**
  149. * Sets label.
  150. *
  151. * @param string $label
  152. *
  153. * @return $this
  154. */
  155. public function setLabel($label)
  156. {
  157. $this->label = $label;
  158. return $this;
  159. }
  160. /**
  161. * Gets label.
  162. *
  163. * @return string
  164. */
  165. public function getLabel()
  166. {
  167. return $this->label;
  168. }
  169. /**
  170. * Sets cycleEnum.
  171. *
  172. * @param string $cycleEnum
  173. *
  174. * @return $this
  175. */
  176. public function setCycleEnum($cycleEnum)
  177. {
  178. $this->cycleEnum = $cycleEnum;
  179. return $this;
  180. }
  181. /**
  182. * Gets cycleEnum.
  183. *
  184. * @return string
  185. */
  186. public function getCycleEnum()
  187. {
  188. return $this->cycleEnum;
  189. }
  190. /**
  191. * Sets isSystem.
  192. *
  193. * @param bool $isSystem
  194. *
  195. * @return $this
  196. */
  197. public function setIsSystem($isSystem)
  198. {
  199. $this->isSystem = $isSystem;
  200. return $this;
  201. }
  202. /**
  203. * Gets isSystem.
  204. *
  205. * @return bool
  206. */
  207. public function getIsSystem()
  208. {
  209. return $this->isSystem;
  210. }
  211. /**
  212. * Add cycleByEducation
  213. *
  214. * @param \AppBundle\Entity\Education\CycleByEducation $cycleByEducation
  215. *
  216. * @return Cycle
  217. */
  218. public function addCycleByEducation(\AppBundle\Entity\Education\CycleByEducation $cycleByEducation)
  219. {
  220. $this->cycleByEducations[] = $cycleByEducation;
  221. return $this;
  222. }
  223. /**
  224. * Remove cycleByEducation
  225. *
  226. * @param \AppBundle\Entity\Education\CycleByEducation $cycleByEducation
  227. */
  228. public function removeCycleByEducation(\AppBundle\Entity\Education\CycleByEducation $cycleByEducation)
  229. {
  230. $this->cycleByEducations->removeElement($cycleByEducation);
  231. }
  232. /**
  233. * Get cycleByEducations
  234. *
  235. * @return \Doctrine\Common\Collections\Collection
  236. */
  237. public function getCycleByEducations()
  238. {
  239. return $this->cycleByEducations;
  240. }
  241. }