PublicEvent.php 10 KB

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