PublicEvent.php 12 KB

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