PublicEvent.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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', 'price_mini', 'price_maxi'])]
  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. #[ORM\Column]
  86. private int $price_mini;
  87. #[ORM\Column]
  88. private int $price_maxi;
  89. /**
  90. * @return string
  91. */
  92. public function getUuid(): string
  93. {
  94. return $this->uuid;
  95. }
  96. /**
  97. * @param string $uuid
  98. * @return PublicEvent
  99. */
  100. public function setUuid(string $uuid): PublicEvent
  101. {
  102. $this->uuid = $uuid;
  103. return $this;
  104. }
  105. /**
  106. * @return int|null
  107. */
  108. public function getOrganizationId(): ?int
  109. {
  110. return $this->organizationId;
  111. }
  112. /**
  113. * @param int|null $organizationId
  114. * @return PublicEvent
  115. */
  116. public function setOrganizationId(?int $organizationId): PublicEvent
  117. {
  118. $this->organizationId = $organizationId;
  119. return $this;
  120. }
  121. /**
  122. * @return string
  123. */
  124. public function getName(): string
  125. {
  126. return $this->name;
  127. }
  128. /**
  129. * @param string $name
  130. * @return PublicEvent
  131. */
  132. public function setName(string $name): PublicEvent
  133. {
  134. $this->name = $name;
  135. return $this;
  136. }
  137. /**
  138. * @return string|null
  139. */
  140. public function getDescription(): ?string
  141. {
  142. return $this->description;
  143. }
  144. /**
  145. * @param string|null $description
  146. * @return PublicEvent
  147. */
  148. public function setDescription(?string $description): PublicEvent
  149. {
  150. $this->description = $description;
  151. return $this;
  152. }
  153. /**
  154. * @return string|null
  155. */
  156. public function getUrl(): ?string
  157. {
  158. return $this->url;
  159. }
  160. /**
  161. * @param string|null $url
  162. * @return PublicEvent
  163. */
  164. public function setUrl(?string $url): PublicEvent
  165. {
  166. $this->url = $url;
  167. return $this;
  168. }
  169. /**
  170. * @return \DateTime
  171. */
  172. public function getDatetimeStart(): \DateTime
  173. {
  174. return $this->datetimeStart;
  175. }
  176. /**
  177. * @param \DateTime $datetimeStart
  178. * @return PublicEvent
  179. */
  180. public function setDatetimeStart(\DateTime $datetimeStart): PublicEvent
  181. {
  182. $this->datetimeStart = $datetimeStart;
  183. return $this;
  184. }
  185. /**
  186. * @return \DateTime
  187. */
  188. public function getDatetimeEnd(): \DateTime
  189. {
  190. return $this->datetimeEnd;
  191. }
  192. /**
  193. * @param \DateTime $datetimeEnd
  194. * @return PublicEvent
  195. */
  196. public function setDatetimeEnd(\DateTime $datetimeEnd): PublicEvent
  197. {
  198. $this->datetimeEnd = $datetimeEnd;
  199. return $this;
  200. }
  201. /**
  202. * @return string|null
  203. */
  204. public function getCity(): ?string
  205. {
  206. return $this->city;
  207. }
  208. /**
  209. * @param string|null $city
  210. * @return PublicEvent
  211. */
  212. public function setCity(?string $city): PublicEvent
  213. {
  214. $this->city = $city;
  215. return $this;
  216. }
  217. /**
  218. * @return string|null
  219. */
  220. public function getPostalCode(): ?string
  221. {
  222. return $this->postalCode;
  223. }
  224. /**
  225. * @param string|null $postalCode
  226. * @return PublicEvent
  227. */
  228. public function setPostalCode(?string $postalCode): PublicEvent
  229. {
  230. $this->postalCode = $postalCode;
  231. return $this;
  232. }
  233. /**
  234. * @return string|null
  235. */
  236. public function getStreetAddress(): ?string
  237. {
  238. return $this->streetAddress;
  239. }
  240. /**
  241. * @param string|null $streetAddress
  242. * @return PublicEvent
  243. */
  244. public function setStreetAddress(?string $streetAddress): PublicEvent
  245. {
  246. $this->streetAddress = $streetAddress;
  247. return $this;
  248. }
  249. /**
  250. * @return float|null
  251. */
  252. public function getLongitude(): ?float
  253. {
  254. return $this->longitude;
  255. }
  256. /**
  257. * @param float|null $longitude
  258. * @return PublicEvent
  259. */
  260. public function setLongitude(?float $longitude): PublicEvent
  261. {
  262. $this->longitude = $longitude;
  263. return $this;
  264. }
  265. /**
  266. * @return float|null
  267. */
  268. public function getLatitude(): ?float
  269. {
  270. return $this->latitude;
  271. }
  272. /**
  273. * @param float|null $latitude
  274. * @return PublicEvent
  275. */
  276. public function setLatitude(?float $latitude): PublicEvent
  277. {
  278. $this->latitude = $latitude;
  279. return $this;
  280. }
  281. /**
  282. * @return string|null
  283. */
  284. public function getRoomName(): ?string
  285. {
  286. return $this->roomName;
  287. }
  288. /**
  289. * @param string|null $roomName
  290. * @return PublicEvent
  291. */
  292. public function setRoomName(?string $roomName): PublicEvent
  293. {
  294. $this->roomName = $roomName;
  295. return $this;
  296. }
  297. /**
  298. * @return string|null
  299. */
  300. public function getRoomDescription(): ?string
  301. {
  302. return $this->roomDescription;
  303. }
  304. /**
  305. * @param string|null $roomDescription
  306. * @return PublicEvent
  307. */
  308. public function setRoomDescription(?string $roomDescription): PublicEvent
  309. {
  310. $this->roomDescription = $roomDescription;
  311. return $this;
  312. }
  313. /**
  314. * @return string|null
  315. */
  316. public function getRoomLocalisation(): ?string
  317. {
  318. return $this->roomLocalisation;
  319. }
  320. /**
  321. * @param string|null $roomLocalisation
  322. * @return PublicEvent
  323. */
  324. public function setRoomLocalisation(?string $roomLocalisation): PublicEvent
  325. {
  326. $this->roomLocalisation = $roomLocalisation;
  327. return $this;
  328. }
  329. /**
  330. * @return string|null
  331. */
  332. public function getRoomCapacity(): ?string
  333. {
  334. return $this->roomCapacity;
  335. }
  336. /**
  337. * @param string|null $roomCapacity
  338. * @return PublicEvent
  339. */
  340. public function setRoomCapacity(?string $roomCapacity): PublicEvent
  341. {
  342. $this->roomCapacity = $roomCapacity;
  343. return $this;
  344. }
  345. /**
  346. * @return string|null
  347. */
  348. public function getRoomFloorSize(): ?string
  349. {
  350. return $this->roomFloorSize;
  351. }
  352. /**
  353. * @param string|null $roomFloorSize
  354. * @return PublicEvent
  355. */
  356. public function setRoomFloorSize(?string $roomFloorSize): PublicEvent
  357. {
  358. $this->roomFloorSize = $roomFloorSize;
  359. return $this;
  360. }
  361. /**
  362. * @return string|null
  363. */
  364. public function getImageUrl(): ?string
  365. {
  366. return $this->imageUrl;
  367. }
  368. /**
  369. * @param string|null $imageUrl
  370. * @return PublicEvent
  371. */
  372. public function setImageUrl(?string $imageUrl): PublicEvent
  373. {
  374. $this->imageUrl = $imageUrl;
  375. return $this;
  376. }
  377. /**
  378. * @return string|null
  379. */
  380. public function getThumbnailUrl(): ?string
  381. {
  382. return $this->thumbnailUrl;
  383. }
  384. /**
  385. * @param string|null $thumbnailUrl
  386. * @return PublicEvent
  387. */
  388. public function setThumbnailUrl(?string $thumbnailUrl): PublicEvent
  389. {
  390. $this->thumbnailUrl = $thumbnailUrl;
  391. return $this;
  392. }
  393. /**
  394. * @return list<string>|null
  395. */
  396. public function getCategories(): ?array
  397. {
  398. return $this->categories;
  399. }
  400. /**
  401. * @param list<string>|null $categories
  402. * @return PublicEvent
  403. */
  404. public function setCategories(?array $categories): PublicEvent
  405. {
  406. $this->categories = $categories;
  407. return $this;
  408. }
  409. /**
  410. * @return string
  411. */
  412. public function getOrigin(): string
  413. {
  414. return $this->origin;
  415. }
  416. /**
  417. * @param string $origin
  418. * @return PublicEvent
  419. */
  420. public function setOrigin(string $origin): PublicEvent
  421. {
  422. $this->origin = $origin;
  423. return $this;
  424. }
  425. /**
  426. * @return int
  427. */
  428. public function getEntityId(): int
  429. {
  430. return $this->entityId;
  431. }
  432. /**
  433. * @param int $entityId
  434. * @return PublicEvent
  435. */
  436. public function setEntityId(int $entityId): PublicEvent
  437. {
  438. $this->entityId = $entityId;
  439. return $this;
  440. }
  441. /**
  442. * @return int
  443. */
  444. public function getPriceMini(): int
  445. {
  446. return $this->price_mini;
  447. }
  448. /**
  449. * @param int $price_mini
  450. * @return PublicEvent
  451. */
  452. public function setPriceMini(int $price_mini): PublicEvent
  453. {
  454. $this->price_mini = $price_mini;
  455. return $this;
  456. }
  457. /**
  458. * @return int
  459. */
  460. public function getPriceMaxi(): int
  461. {
  462. return $this->price_maxi;
  463. }
  464. /**
  465. * @param int $price_maxi
  466. * @return PublicEvent
  467. */
  468. public function setPriceMaxi(int $price_maxi): PublicEvent
  469. {
  470. $this->price_maxi = $price_maxi;
  471. return $this;
  472. }
  473. }