PublicEvent.php 10 KB

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