FederationStructure.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483
  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\NumericFilter;
  8. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  9. use ApiPlatform\Metadata\ApiFilter;
  10. use App\Filter\ApiPlatform\Utils\FindInSetFilter;
  11. use App\Repository\Public\FederationStructureRepository;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. /**
  15. * Structure telle qu'elle est représentée sur l'iframe de recherche des structures d'une fédération
  16. *
  17. * Fichier source de la view : ./sql/schema-extensions/002-view_federation_structures.sql
  18. */
  19. #[ApiResource(
  20. operations: [
  21. new Get(
  22. uriTemplate: '/public/federation_structures/{id}',
  23. requirements: ['id' => '\\d+'],
  24. normalizationContext: ['groups' => ['federation_structure_item_get']]
  25. ),
  26. new GetCollection(
  27. uriTemplate: '/public/federation_structures',
  28. normalizationContext: ['groups' => ['federation_structure_collection_get']]
  29. )
  30. ],
  31. paginationEnabled: false
  32. )]
  33. #[ORM\Entity(repositoryClass: FederationStructureRepository::class, readOnly: true)]
  34. #[ORM\Table(name: "view_federation_structures")]
  35. #[ApiFilter(filterClass: SearchFilter::class, properties: ['name' => 'partial', 'city' => 'exact'])]
  36. #[ApiFilter(filterClass: NumericFilter::class, properties: ['id', 'parentId'])]
  37. #[ApiFilter(filterClass: FindInSetFilter::class, properties: ['parents'])]
  38. class FederationStructure
  39. {
  40. #[ORM\Id]
  41. #[ORM\Column]
  42. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  43. private int $id;
  44. #[ORM\Column]
  45. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  46. private ?string $name;
  47. #[ORM\Column(type: 'integer', nullable: true)]
  48. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  49. private ?int $logoId;
  50. #[ORM\Column]
  51. #[Groups(["federation_structure_item_get"])]
  52. private ?string $description;
  53. #[ORM\Column(type: 'integer')]
  54. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  55. private ?int $imageId;
  56. #[ORM\Column]
  57. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  58. private ?string $type;
  59. #[ORM\Column(nullable: true)]
  60. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  61. private ?string $website;
  62. /** @var mixed[] */
  63. #[ORM\Column(type: 'json')]
  64. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  65. private array $addresses;
  66. #[ORM\Column]
  67. #[Groups(["federation_structure_item_get"])]
  68. private ?string $phone;
  69. #[ORM\Column]
  70. #[Groups(["federation_structure_item_get"])]
  71. private ?string $mobilePhone;
  72. #[ORM\Column]
  73. #[Groups(["federation_structure_item_get"])]
  74. private ?string $email;
  75. #[ORM\Column]
  76. #[Groups(["federation_structure_item_get"])]
  77. private ?string $facebook;
  78. #[ORM\Column]
  79. #[Groups(["federation_structure_item_get"])]
  80. private ?string $twitter;
  81. #[ORM\Column]
  82. #[Groups(["federation_structure_item_get"])]
  83. private ?string $instagram;
  84. #[ORM\Column]
  85. #[Groups(["federation_structure_item_get"])]
  86. private ?string $youtube;
  87. /** @var mixed[]|null */
  88. #[ORM\Column(type: 'json')]
  89. #[Groups(["federation_structure_item_get"])]
  90. private ?array $articles;
  91. /** @var list<string>|null */
  92. #[ORM\Column(type: 'simple_array')]
  93. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  94. private ?array $practices;
  95. #[ORM\Column(type: 'integer')]
  96. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  97. private ?int $parentId;
  98. #[ORM\Column]
  99. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  100. private ?string $parentName;
  101. /** @var list<string> */
  102. #[ORM\Column(type: 'simple_array')]
  103. #[Groups(["federation_structure_item_get", "federation_structure_collection_get"])]
  104. private array $parents;
  105. /**
  106. * @return int
  107. */
  108. public function getId(): int
  109. {
  110. return $this->id;
  111. }
  112. /**
  113. * @param int $id
  114. * @return FederationStructure
  115. */
  116. public function setId(int $id): FederationStructure
  117. {
  118. $this->id = $id;
  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 FederationStructure
  131. */
  132. public function setName(string $name): FederationStructure
  133. {
  134. $this->name = $name;
  135. return $this;
  136. }
  137. /**
  138. * @return int|null
  139. */
  140. public function getLogoId(): ?int
  141. {
  142. return $this->logoId;
  143. }
  144. /**
  145. * @param int|null $logoId
  146. * @return FederationStructure
  147. */
  148. public function setLogoId(?int $logoId): FederationStructure
  149. {
  150. $this->logoId = $logoId;
  151. return $this;
  152. }
  153. /**
  154. * @return string|null
  155. */
  156. public function getDescription(): ?string
  157. {
  158. return $this->description;
  159. }
  160. /**
  161. * @param string|null $description
  162. * @return FederationStructure
  163. */
  164. public function setDescription(?string $description): FederationStructure
  165. {
  166. $this->description = $description;
  167. return $this;
  168. }
  169. /**
  170. * @return int|null
  171. */
  172. public function getImageId(): ?int
  173. {
  174. return $this->imageId;
  175. }
  176. /**
  177. * @param int|null $imageId
  178. * @return FederationStructure
  179. */
  180. public function setImageId(?int $imageId): FederationStructure
  181. {
  182. $this->imageId = $imageId;
  183. return $this;
  184. }
  185. /**
  186. * @return string|null
  187. */
  188. public function getType(): ?string
  189. {
  190. return $this->type;
  191. }
  192. /**
  193. * @param string|null $type
  194. * @return FederationStructure
  195. */
  196. public function setType(?string $type): FederationStructure
  197. {
  198. $this->type = $type;
  199. return $this;
  200. }
  201. /**
  202. * @return string|null
  203. */
  204. public function getWebsite(): ?string
  205. {
  206. return $this->website;
  207. }
  208. /**
  209. * @param string|null $website
  210. * @return FederationStructure
  211. */
  212. public function setWebsite(?string $website): FederationStructure
  213. {
  214. $this->website = $website;
  215. return $this;
  216. }
  217. /**
  218. * @return mixed[]
  219. */
  220. public function getAddresses(): array
  221. {
  222. return $this->addresses;
  223. }
  224. /**
  225. * @param mixed[] $addresses
  226. * @return FederationStructure
  227. */
  228. public function setAddresses(array $addresses): FederationStructure
  229. {
  230. $this->addresses = $addresses;
  231. return $this;
  232. }
  233. /**
  234. * @return string|null
  235. */
  236. public function getPhone(): ?string
  237. {
  238. return $this->phone;
  239. }
  240. /**
  241. * @param string|null $phone
  242. * @return FederationStructure
  243. */
  244. public function setPhone(?string $phone): FederationStructure
  245. {
  246. $this->phone = $phone;
  247. return $this;
  248. }
  249. /**
  250. * @return string|null
  251. */
  252. public function getMobilePhone(): ?string
  253. {
  254. return $this->mobilePhone;
  255. }
  256. /**
  257. * @param string|null $mobilePhone
  258. * @return FederationStructure
  259. */
  260. public function setMobilePhone(?string $mobilePhone): FederationStructure
  261. {
  262. $this->mobilePhone = $mobilePhone;
  263. return $this;
  264. }
  265. /**
  266. * @return string|null
  267. */
  268. public function getEmail(): ?string
  269. {
  270. return $this->email;
  271. }
  272. /**
  273. * @param string|null $email
  274. */
  275. public function setEmail(?string $email): self
  276. {
  277. $this->email = $email;
  278. return $this;
  279. }
  280. /**
  281. * @return string|null
  282. */
  283. public function getFacebook(): ?string
  284. {
  285. return $this->facebook;
  286. }
  287. /**
  288. * @param string|null $facebook
  289. */
  290. public function setFacebook(?string $facebook): self
  291. {
  292. $this->facebook = $facebook;
  293. return $this;
  294. }
  295. /**
  296. * @return string|null
  297. */
  298. public function getTwitter(): ?string
  299. {
  300. return $this->twitter;
  301. }
  302. /**
  303. * @param string|null $twitter
  304. */
  305. public function setTwitter(?string $twitter): self
  306. {
  307. $this->twitter = $twitter;
  308. return $this;
  309. }
  310. /**
  311. * @return string|null
  312. */
  313. public function getInstagram(): ?string
  314. {
  315. return $this->instagram;
  316. }
  317. /**
  318. * @param string|null $instagram
  319. */
  320. public function setInstagram(?string $instagram): self
  321. {
  322. $this->instagram = $instagram;
  323. return $this;
  324. }
  325. /**
  326. * @return string|null
  327. */
  328. public function getYoutube(): ?string
  329. {
  330. return $this->youtube;
  331. }
  332. /**
  333. * @param string|null $youtube
  334. * @return FederationStructure
  335. */
  336. public function setYoutube(?string $youtube): FederationStructure
  337. {
  338. $this->youtube = $youtube;
  339. return $this;
  340. }
  341. /**
  342. * @return mixed[]|null
  343. */
  344. public function getArticles(): ?array
  345. {
  346. return $this->articles;
  347. }
  348. /**
  349. * @param mixed[]|null $articles
  350. * @return FederationStructure
  351. */
  352. public function setArticles(?array $articles): FederationStructure
  353. {
  354. $this->articles = $articles;
  355. return $this;
  356. }
  357. /**
  358. * @return list<string>|null
  359. */
  360. public function getPractices(): ?array
  361. {
  362. return $this->practices;
  363. }
  364. /**
  365. * @param list<string>|null $practices
  366. * @return FederationStructure
  367. */
  368. public function setPractices(?array $practices): FederationStructure
  369. {
  370. $this->practices = $practices;
  371. return $this;
  372. }
  373. /**
  374. * @return int|null
  375. */
  376. public function getParentId(): ?int
  377. {
  378. return $this->parentId;
  379. }
  380. /**
  381. * @param int|null $parentId
  382. * @return FederationStructure
  383. */
  384. public function setParentId(?int $parentId): FederationStructure
  385. {
  386. $this->parentId = $parentId;
  387. return $this;
  388. }
  389. /**
  390. * @return string|null
  391. */
  392. public function getParentName(): ?string
  393. {
  394. return $this->parentName;
  395. }
  396. /**
  397. * @param string|null $parentName
  398. * @return FederationStructure
  399. */
  400. public function setParentName(?string $parentName): FederationStructure
  401. {
  402. $this->parentName = $parentName;
  403. return $this;
  404. }
  405. /**
  406. * @return list<string>
  407. */
  408. public function getParents(): array
  409. {
  410. return $this->parents;
  411. }
  412. /**
  413. * @param list<string> $parents
  414. * @return FederationStructure
  415. */
  416. public function setParents(array $parents): FederationStructure
  417. {
  418. $this->parents = $parents;
  419. return $this;
  420. }
  421. }