Jury.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <?php
  2. namespace AppBundle\Entity\Organization;
  3. use AppBundle\Annotation\DefaultField;
  4. use AppBundle\Entity\Core\Tagg;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Dunglas\ApiBundle\Annotation\Iri;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use AppBundle\Entity\Traits\TimestampableEntity;
  10. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. /**
  13. * Jury composé d'Access pour unr Organization
  14. *
  15. * @Iri("http://schema.org/Jury")
  16. */
  17. #[ORM\Entity]
  18. class Jury
  19. {
  20. use TimestampableEntity;
  21. use CreatorUpdaterEntity;
  22. /**
  23. * @var int
  24. */
  25. #[ORM\Column(type: 'integer')]
  26. #[ORM\Id]
  27. #[ORM\GeneratedValue(strategy: 'AUTO')]
  28. #[Groups(['jury', 'jury_access', 'examenconvocation_list_examen', 'examen_details', 'planning_detail', 'presence_attendance'])]
  29. private $id;
  30. /**
  31. * @var Organization
  32. *
  33. * @DefaultField
  34. */
  35. #[ORM\ManyToOne(targetEntity: 'Organization', inversedBy: 'juries')]
  36. #[ORM\JoinColumn(nullable: false)]
  37. #[Assert\NotNull]
  38. #[Groups(['jury'])]
  39. private $organization;
  40. /**
  41. * @var string
  42. */
  43. #[ORM\Column(type: 'string', length: 35)]
  44. #[Assert\Type(type: 'string')]
  45. #[Assert\NotNull]
  46. #[Groups(['jury', 'jury_reference', 'examenconvocation_list_examen', 'examen_details_jury'])]
  47. private $name;
  48. /**
  49. * @var \DateTime
  50. */
  51. #[ORM\Column(type: 'date', nullable: true)]
  52. #[Assert\Date]
  53. #[Groups(['jury'])]
  54. private $date;
  55. /**
  56. * @var \DateTime
  57. */
  58. #[ORM\Column(type: 'date', nullable: true)]
  59. #[Assert\Date]
  60. #[Groups(['jury'])]
  61. private $endDate;
  62. /**
  63. * @var Access
  64. */
  65. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'juryMembers', cascade: ['persist'])]
  66. #[ORM\JoinTable(name: 'juries_members')]
  67. #[Groups(['jury_access', 'examen_details_jury', 'presence_attendance_jury', 'planning_detail_jury'])]
  68. private $members;
  69. /**
  70. * @var ArrayCollection<Examen>
  71. */
  72. #[ORM\OneToMany(targetEntity: 'AppBundle\Entity\Booking\Examen', mappedBy: 'jury')]
  73. #[Groups(['jury_examen'])]
  74. private $examens;
  75. /**
  76. * @var ArrayCollection<Tagg>
  77. */
  78. #[ORM\ManyToMany(targetEntity: 'AppBundle\Entity\Core\Tagg', cascade: ['persist'], inversedBy: 'juries')]
  79. #[Assert\Valid]
  80. #[ORM\JoinTable(name: 'tag_jury', joinColumns: [], inverseJoinColumns: [])]
  81. #[ORM\JoinColumn(name: 'jury_id', referencedColumnName: 'id')]
  82. #[ORM\JoinColumn(name: 'tag_id', referencedColumnName: 'id')]
  83. #[Groups(['jury_tags', 'manage_tags'])]
  84. private $tags;
  85. public function __construct() {
  86. $this->members = new ArrayCollection();
  87. $this->examens = new ArrayCollection();
  88. $this->tags = new ArrayCollection();
  89. }
  90. /**
  91. * Sets id.
  92. *
  93. * @param int $id
  94. *
  95. * @return $this
  96. */
  97. public function setId($id)
  98. {
  99. $this->id = $id;
  100. return $this;
  101. }
  102. /**
  103. * Gets id.
  104. *
  105. * @return int
  106. */
  107. public function getId()
  108. {
  109. return $this->id;
  110. }
  111. /**
  112. * Sets organization.
  113. *
  114. * @param Organization $organization
  115. *
  116. * @return $this
  117. */
  118. public function setOrganization(Organization $organization)
  119. {
  120. $this->organization = $organization;
  121. return $this;
  122. }
  123. /**
  124. * Gets organization.
  125. *
  126. * @return Organization
  127. */
  128. public function getOrganization()
  129. {
  130. return $this->organization;
  131. }
  132. /**
  133. * Sets name.
  134. *
  135. * @param string $name
  136. *
  137. * @return $this
  138. */
  139. public function setName($name)
  140. {
  141. $this->name = $name;
  142. return $this;
  143. }
  144. /**
  145. * Gets name.
  146. *
  147. * @return string
  148. */
  149. public function getName()
  150. {
  151. return $this->name;
  152. }
  153. /**
  154. * Sets date.
  155. *
  156. * @param \DateTime $date
  157. *
  158. * @return $this
  159. */
  160. public function setDate(\DateTime $date = null)
  161. {
  162. $this->date = $date;
  163. return $this;
  164. }
  165. /**
  166. * Gets date.
  167. *
  168. * @return \DateTime
  169. */
  170. public function getDate()
  171. {
  172. return $this->date;
  173. }
  174. /**
  175. * Gets members.
  176. *
  177. * @return ArrayCollection<JuryMember>
  178. */
  179. public function getMembers()
  180. {
  181. return ($this->members) ? array_values($this->members->toArray()) : new ArrayCollection();
  182. }
  183. /**
  184. * Add member
  185. *
  186. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  187. *
  188. * @return Jury
  189. */
  190. public function addMember(\AppBundle\Entity\AccessAndFunction\Access $access)
  191. {
  192. $this->members[] = $access;
  193. return $this;
  194. }
  195. /**
  196. * Remove member
  197. *
  198. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  199. */
  200. public function removeMember(\AppBundle\Entity\AccessAndFunction\Access $access)
  201. {
  202. $this->members->removeElement($access);
  203. }
  204. /**
  205. * Add examen
  206. *
  207. * @param \AppBundle\Entity\Booking\Examen $examen
  208. *
  209. * @return Jury
  210. */
  211. public function addExamen(\AppBundle\Entity\Booking\Examen $examen)
  212. {
  213. $this->examens[] = $examen;
  214. return $this;
  215. }
  216. /**
  217. * Remove examen
  218. *
  219. * @param \AppBundle\Entity\Booking\Examen $examen
  220. */
  221. public function removeExamen(\AppBundle\Entity\Booking\Examen $examen)
  222. {
  223. $this->examens->removeElement($examen);
  224. }
  225. /**
  226. * Get examens
  227. *
  228. * @return \Doctrine\Common\Collections\Collection
  229. */
  230. public function getExamens()
  231. {
  232. return $this->examens;
  233. }
  234. /**
  235. * Set endDate
  236. *
  237. * @param \DateTime $endDate
  238. *
  239. * @return Jury
  240. */
  241. public function setEndDate($endDate)
  242. {
  243. $this->endDate = $endDate;
  244. return $this;
  245. }
  246. /**
  247. * Get endDate
  248. *
  249. * @return \DateTime
  250. */
  251. public function getEndDate()
  252. {
  253. return $this->endDate;
  254. }
  255. /**
  256. * Add tag
  257. *
  258. * @param \AppBundle\Entity\Core\Tagg $tag
  259. *
  260. * @return Jury
  261. */
  262. public function addTag(\AppBundle\Entity\Core\Tagg $tag)
  263. {
  264. $this->tags[] = $tag;
  265. return $this;
  266. }
  267. /**
  268. * Remove tag
  269. *
  270. * @param \AppBundle\Entity\Core\Tagg $tag
  271. */
  272. public function removeTag(\AppBundle\Entity\Core\Tagg $tag)
  273. {
  274. $this->tags->removeElement($tag);
  275. }
  276. /**
  277. * Get tags
  278. *
  279. * @return \Doctrine\Common\Collections\Collection
  280. */
  281. public function getTags()
  282. {
  283. return $this->tags;
  284. }
  285. }