FederationStructure.php 11 KB

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