add idSite and idBuilding to get_floor

This commit is contained in:
Kouril42
2023-02-19 12:34:40 +01:00
parent e3f16127af
commit c6222386a0
3 changed files with 21 additions and 10 deletions
+6 -2
View File
@@ -91,7 +91,7 @@ class MapApiController extends AbstractController
elseif (sizeof($floors)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one floorId ; the BDD is corrupted.'); }
$floor = $floors[0];
$places = $floor->getPlaces();
$jsonPlaces = new ArrayCollection();
$jsonPlaces = array();
if ($representation == 'Cylinder' || $representation == 'PolySurface'){
foreach ($places as $place){
$jsonPlaces[] = array(
@@ -105,7 +105,11 @@ class MapApiController extends AbstractController
else {
return $this->json(["Error on represantation attribute"]);
}
return $this->json($jsonPlaces->toArray());
$building = $floor->getBuilding();
return $this->json(['idSite' => $building->getId(),
'idBuilding' => $building->getSite()->getId(),
'places' => $jsonPlaces
]);
}
#[Route('/api/map/get_all_floors/')]