mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 22:51:04 +01:00
Debug API
This commit is contained in:
parent
c6222386a0
commit
88ec6295fc
@ -58,7 +58,7 @@ class MapApiController extends AbstractController
|
|||||||
public function get_site_name(SiteRepository $rep, int $id): JsonResponse
|
public function get_site_name(SiteRepository $rep, int $id): JsonResponse
|
||||||
{
|
{
|
||||||
$sites = $rep->findSiteById($id);
|
$sites = $rep->findSiteById($id);
|
||||||
if (sizeof($sites) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any place.'); }
|
if (sizeof($sites) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any site.'); }
|
||||||
elseif (sizeof($sites)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one siteId ; the BDD is corrupted.'); }
|
elseif (sizeof($sites)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one siteId ; the BDD is corrupted.'); }
|
||||||
return $this->json($sites[0]->getName());
|
return $this->json($sites[0]->getName());
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ class MapApiController extends AbstractController
|
|||||||
public function get_building_name(BuildingRepository $rep, int $id): JsonResponse
|
public function get_building_name(BuildingRepository $rep, int $id): JsonResponse
|
||||||
{
|
{
|
||||||
$buildings = $rep->findBuildingById($id);
|
$buildings = $rep->findBuildingById($id);
|
||||||
if (sizeof($buildings) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any place.'); }
|
if (sizeof($buildings) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any building.'); }
|
||||||
elseif (sizeof($buildings)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one buildingId ; the BDD is corrupted.'); }
|
elseif (sizeof($buildings)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one buildingId ; the BDD is corrupted.'); }
|
||||||
return $this->json($buildings[0]->getName());
|
return $this->json($buildings[0]->getName());
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ class MapApiController extends AbstractController
|
|||||||
public function get_floor_name(FloorRepository $rep, int $id): JsonResponse
|
public function get_floor_name(FloorRepository $rep, int $id): JsonResponse
|
||||||
{
|
{
|
||||||
$floors = $rep->findFloorById($id);
|
$floors = $rep->findFloorById($id);
|
||||||
if (sizeof($floors) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any place.'); }
|
if (sizeof($floors) == 0) { throw new NotFoundHttpException('Error: '.$id.' doesn\'t correspond to any floor.'); }
|
||||||
elseif (sizeof($floors)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one floorId ; the BDD is corrupted.'); }
|
elseif (sizeof($floors)>1) { throw new Exception('Internal Error: '.$id.' refers to more than one floorId ; the BDD is corrupted.'); }
|
||||||
return $this->json($floors[0]->getName());
|
return $this->json($floors[0]->getName());
|
||||||
}
|
}
|
||||||
@ -106,8 +106,8 @@ class MapApiController extends AbstractController
|
|||||||
return $this->json(["Error on represantation attribute"]);
|
return $this->json(["Error on represantation attribute"]);
|
||||||
}
|
}
|
||||||
$building = $floor->getBuilding();
|
$building = $floor->getBuilding();
|
||||||
return $this->json(['idSite' => $building->getId(),
|
return $this->json(['idSite' => $building->getSite()->getId(),
|
||||||
'idBuilding' => $building->getSite()->getId(),
|
'idBuilding' => $building->getId(),
|
||||||
'places' => $jsonPlaces
|
'places' => $jsonPlaces
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ class MapApiController extends AbstractController
|
|||||||
foreach ($place->getFloors() as $floor) {
|
foreach ($place->getFloors() as $floor) {
|
||||||
$floorsId[] = $floor->getId();
|
$floorsId[] = $floor->getId();
|
||||||
}
|
}
|
||||||
$building = $floorsId[0]->getBuilding();
|
$building = $place->getFloors()[0]->getBuilding();
|
||||||
$all[] = array('idRoom' => $place->getId(),
|
$all[] = array('idRoom' => $place->getId(),
|
||||||
'idSite' => $building->getSite()->getId(),
|
'idSite' => $building->getSite()->getId(),
|
||||||
'idBuilding' => $building->getId(),
|
'idBuilding' => $building->getId(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user