PublicEvent.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Public;
  4. use ApiPlatform\Core\Annotation\ApiFilter;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\NumericFilter;
  8. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  9. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  10. use App\Filter\Utils\DistanceFilter;
  11. use App\Repository\Public\PublicEventRepository;
  12. use Doctrine\ORM\Mapping as ORM;
  13. /**
  14. * Évènements publics tels que publiés sur l'agenda du site opentalent ou les sites des structures
  15. *
  16. * Fichier source de la view : ./sql/schema-extensions/001-view_public_events.sql
  17. */
  18. #[ORM\Entity(repositoryClass: PublicEventRepository::class, readOnly: true)]
  19. #[ORM\Table(name: "view_public_events")]
  20. #[ApiResource(
  21. collectionOperations: [
  22. 'get' => [
  23. 'method' => 'GET',
  24. 'path' => '/public/events'
  25. ]
  26. ],
  27. itemOperations: [
  28. 'get' => [
  29. 'method' => 'GET',
  30. 'path' => '/public/events/{uuid}'
  31. ]
  32. ]
  33. )]
  34. #[ApiFilter(SearchFilter::class, properties: ['name' => 'partial', 'city' => 'exact'])]
  35. #[ApiFilter(NumericFilter::class, properties: ['organizationId'])]
  36. #[ApiFilter(DateFilter::class, properties: ['datetimeStart', 'datetimeEnd'])]
  37. #[ApiFilter(DistanceFilter::class)]
  38. #[ApiFilter(OrderFilter::class, properties: ['datetimeStart', 'datetimeEnd'], arguments: ['orderParameterName' => 'order'])]
  39. class PublicEvent
  40. {
  41. #[ORM\Id]
  42. #[ORM\Column]
  43. private string $uuid;
  44. #[ORM\Column(type: 'integer')]
  45. private ?int $organizationId;
  46. #[ORM\Column]
  47. private string $name;
  48. #[ORM\Column(type: 'string')]
  49. private ?string $description;
  50. #[ORM\Column]
  51. private ?string $url;
  52. #[ORM\Column(type: 'datetime')]
  53. private \DateTime $datetimeStart;
  54. #[ORM\Column(type: 'datetime')]
  55. private \DateTime $datetimeEnd;
  56. #[ORM\Column]
  57. private ?string $city;
  58. #[ORM\Column]
  59. private ?string $postalCode;
  60. #[ORM\Column]
  61. private ?string $streetAddress;
  62. #[ORM\Column(type: 'float')]
  63. private ?float $longitude;
  64. #[ORM\Column(type: 'float')]
  65. private ?float $latitude;
  66. #[ORM\Column]
  67. private ?string $roomName;
  68. #[ORM\Column]
  69. private ?string $roomDescription;
  70. #[ORM\Column]
  71. private ?string $roomLocalisation;
  72. #[ORM\Column]
  73. private ?string $roomCapacity;
  74. #[ORM\Column]
  75. private ?string $roomFloorSize;
  76. #[ORM\Column(type: 'integer')]
  77. private ?int $imageId;
  78. #[ORM\Column(type: 'simple_array')]
  79. private ?array $categories;
  80. #[ORM\Column]
  81. private string $origin = 'opentalent';
  82. #[ORM\Column(type: 'integer')]
  83. private int $entityId;
  84. /**
  85. * @return string
  86. */
  87. public function getUuid(): string
  88. {
  89. return $this->uuid;
  90. }
  91. /**
  92. * @param string $uuid
  93. * @return PublicEvent
  94. */
  95. public function setUuid(string $uuid): self
  96. {
  97. $this->uuid = $uuid;
  98. return $this;
  99. }
  100. /**
  101. * @return int|null
  102. */
  103. public function getOrganizationId(): ?int
  104. {
  105. return $this->organizationId;
  106. }
  107. /**
  108. * @param int|null $organizationId
  109. * @return PublicEvent
  110. */
  111. public function setOrganizationId(?int $organizationId): self
  112. {
  113. $this->organizationId = $organizationId;
  114. return $this;
  115. }
  116. /**
  117. * @return string
  118. */
  119. public function getName(): string
  120. {
  121. return $this->name;
  122. }
  123. /**
  124. * @param string $name
  125. * @return PublicEvent
  126. */
  127. public function setName(string $name): self
  128. {
  129. $this->name = $name;
  130. return $this;
  131. }
  132. /**
  133. * @return string|null
  134. */
  135. public function getDescription(): ?string
  136. {
  137. return $this->description;
  138. }
  139. /**
  140. * @param string|null $description
  141. * @return PublicEvent
  142. */
  143. public function setDescription(?string $description): self
  144. {
  145. $this->description = $description;
  146. return $this;
  147. }
  148. /**
  149. * @return string|null
  150. */
  151. public function getUrl(): ?string
  152. {
  153. return $this->url;
  154. }
  155. /**
  156. * @param string|null $url
  157. * @return PublicEvent
  158. */
  159. public function setUrl(?string $url): self
  160. {
  161. $this->url = $url;
  162. return $this;
  163. }
  164. /**
  165. * @return \DateTime
  166. */
  167. public function getDatetimeStart(): \DateTime
  168. {
  169. return $this->datetimeStart;
  170. }
  171. /**
  172. * @param \DateTime $datetimeStart
  173. * @return PublicEvent
  174. */
  175. public function setDatetimeStart(\DateTime $datetimeStart): self
  176. {
  177. $this->datetimeStart = $datetimeStart;
  178. return $this;
  179. }
  180. /**
  181. * @return \DateTime
  182. */
  183. public function getDatetimeEnd(): \DateTime
  184. {
  185. return $this->datetimeEnd;
  186. }
  187. /**
  188. * @param \DateTime $datetimeEnd
  189. * @return PublicEvent
  190. */
  191. public function setDatetimeEnd(\DateTime $datetimeEnd): self
  192. {
  193. $this->datetimeEnd = $datetimeEnd;
  194. return $this;
  195. }
  196. /**
  197. * @return string|null
  198. */
  199. public function getCity(): ?string
  200. {
  201. return $this->city;
  202. }
  203. /**
  204. * @param string|null $city
  205. * @return PublicEvent
  206. */
  207. public function setCity(?string $city): self
  208. {
  209. $this->city = $city;
  210. return $this;
  211. }
  212. /**
  213. * @return string|null
  214. */
  215. public function getPostalCode(): ?string
  216. {
  217. return $this->postalCode;
  218. }
  219. /**
  220. * @param string|null $postalCode
  221. * @return PublicEvent
  222. */
  223. public function setPostalCode(?string $postalCode): self
  224. {
  225. $this->postalCode = $postalCode;
  226. return $this;
  227. }
  228. /**
  229. * @return string|null
  230. */
  231. public function getStreetAddress(): ?string
  232. {
  233. return $this->streetAddress;
  234. }
  235. /**
  236. * @param string|null $streetAddress
  237. * @return PublicEvent
  238. */
  239. public function setStreetAddress(?string $streetAddress): self
  240. {
  241. $this->streetAddress = $streetAddress;
  242. return $this;
  243. }
  244. /**
  245. * @return float|null
  246. */
  247. public function getLongitude(): ?float
  248. {
  249. return $this->longitude;
  250. }
  251. /**
  252. * @param float|null $longitude
  253. * @return PublicEvent
  254. */
  255. public function setLongitude(?float $longitude): self
  256. {
  257. $this->longitude = $longitude;
  258. return $this;
  259. }
  260. /**
  261. * @return float|null
  262. */
  263. public function getLatitude(): ?float
  264. {
  265. return $this->latitude;
  266. }
  267. /**
  268. * @param float|null $latitude
  269. * @return PublicEvent
  270. */
  271. public function setLatitude(?float $latitude): self
  272. {
  273. $this->latitude = $latitude;
  274. return $this;
  275. }
  276. /**
  277. * @return string|null
  278. */
  279. public function getRoomName(): ?string
  280. {
  281. return $this->roomName;
  282. }
  283. /**
  284. * @param string|null $roomName
  285. * @return PublicEvent
  286. */
  287. public function setRoomName(?string $roomName): self
  288. {
  289. $this->roomName = $roomName;
  290. return $this;
  291. }
  292. /**
  293. * @return string|null
  294. */
  295. public function getRoomDescription(): ?string
  296. {
  297. return $this->roomDescription;
  298. }
  299. /**
  300. * @param string|null $roomDescription
  301. * @return PublicEvent
  302. */
  303. public function setRoomDescription(?string $roomDescription): self
  304. {
  305. $this->roomDescription = $roomDescription;
  306. return $this;
  307. }
  308. /**
  309. * @return string|null
  310. */
  311. public function getRoomLocalisation(): ?string
  312. {
  313. return $this->roomLocalisation;
  314. }
  315. /**
  316. * @param string|null $roomLocalisation
  317. * @return PublicEvent
  318. */
  319. public function setRoomLocalisation(?string $roomLocalisation): self
  320. {
  321. $this->roomLocalisation = $roomLocalisation;
  322. return $this;
  323. }
  324. /**
  325. * @return string|null
  326. */
  327. public function getRoomCapacity(): ?string
  328. {
  329. return $this->roomCapacity;
  330. }
  331. /**
  332. * @param string|null $roomCapacity
  333. * @return PublicEvent
  334. */
  335. public function setRoomCapacity(?string $roomCapacity): self
  336. {
  337. $this->roomCapacity = $roomCapacity;
  338. return $this;
  339. }
  340. /**
  341. * @return string|null
  342. */
  343. public function getRoomFloorSize(): ?string
  344. {
  345. return $this->roomFloorSize;
  346. }
  347. /**
  348. * @param string|null $roomFloorSize
  349. * @return PublicEvent
  350. */
  351. public function setRoomFloorSize(?string $roomFloorSize): self
  352. {
  353. $this->roomFloorSize = $roomFloorSize;
  354. return $this;
  355. }
  356. /**
  357. * @return int|null
  358. */
  359. public function getImageId(): ?int
  360. {
  361. return $this->imageId;
  362. }
  363. /**
  364. * @param int|null $imageId
  365. * @return PublicEvent
  366. */
  367. public function setImageId(?int $imageId): self
  368. {
  369. $this->imageId = $imageId;
  370. return $this;
  371. }
  372. /**
  373. * @return array|null
  374. */
  375. public function getCategories(): ?array
  376. {
  377. return $this->categories;
  378. }
  379. /**
  380. * @param array|null $categories
  381. * @return PublicEvent
  382. */
  383. public function setCategories(?array $categories): self
  384. {
  385. $this->categories = $categories;
  386. return $this;
  387. }
  388. /**
  389. * @return string
  390. */
  391. public function getOrigin(): string
  392. {
  393. return $this->origin;
  394. }
  395. /**
  396. * @param string $origin
  397. * @return PublicEvent
  398. */
  399. public function setOrigin(string $origin): self
  400. {
  401. $this->origin = $origin;
  402. return $this;
  403. }
  404. /**
  405. * @return int
  406. */
  407. public function getEntityId(): int
  408. {
  409. return $this->entityId;
  410. }
  411. /**
  412. * @param int $entityId
  413. * @return PublicEvent
  414. */
  415. public function setEntityId(int $entityId): self
  416. {
  417. $this->entityId = $entityId;
  418. return $this;
  419. }
  420. }