Browse Source

add section block

Vincent 1 year ago
parent
commit
c49e8e38f9

+ 3 - 2
sql/schema-extensions/002-view_federation_structures.sql

@@ -13,13 +13,14 @@ AS
                      WHERE otp.organization_id = o.id)
                AS practices,
            oar.articles, n1.parent_id as parentId, net1.name as parentName,
-           CONCAT_WS(',', n1.parent_id, n2.parent_id, n3.parent_id, n4.parent_id, n5.parent_id) as parents
-
+           CONCAT_WS(',', n1.parent_id, n2.parent_id, n3.parent_id, n4.parent_id, n5.parent_id) as parents,
+           CONCAT('[', GROUP_CONCAT(DISTINCT(COLUMN_JSON(COLUMN_CREATE('id', ac.id,'name', ac.name, 'description', ac.description, 'imageId', ac.imageActivity_id)))), ']') as sections
     FROM opentalent.Organization o
              INNER JOIN opentalent.Parameters p on o.parameters_id = p.id
              LEFT JOIN opentalent.OrganizationAddressPostal oa on oa.organization_id = o.id
              LEFT JOIN opentalent.AddressPostal a on oa.addressPostal_id = a.id
              LEFT JOIN opentalent.Country c ON (c.id = a.addressCountry_id)
+             LEFT JOIN opentalent.Activity ac ON (ac.organization_id = o.id)
              LEFT JOIN opentalent.organization_contactpoint ocp ON ocp.organization_id = o.id
              INNER JOIN (SELECT * FROM opentalent.ContactPoint WHERE `contactType`='PRINCIPAL') cp ON cp.id = ocp.contactPoint_id
              LEFT JOIN (

+ 23 - 0
src/Entity/Public/FederationStructure.php

@@ -132,6 +132,11 @@ class FederationStructure
     #[Groups(['federation_structure_item_get', 'federation_structure_collection_get'])]
     private bool $portailVisibility = false;
 
+    /** @var mixed[] */
+    #[ORM\Column(type: 'json')]
+    #[Groups(['federation_structure_item_get', 'federation_structure_collection_get'])]
+    private array $sections;
+
     public function getId(): int
     {
         return $this->id;
@@ -404,4 +409,22 @@ class FederationStructure
         $this->portailVisibility = $portailVisibility;
         return $this;
     }
+
+    /**
+     * @return mixed[]
+     */
+    public function getSections(): array
+    {
+        return $this->sections;
+    }
+
+    /**
+     * @param mixed[] $sections
+     */
+    public function setSections(array $sections): FederationStructure
+    {
+        $this->sections = $sections;
+
+        return $this;
+    }
 }