mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 14:41:03 +01:00
Add get_all_floors
This commit is contained in:
parent
8f67569b41
commit
5d66658842
@ -80,6 +80,25 @@ class MapApiController extends AbstractController
|
||||
return $this->json($jsonPlaces->toArray());
|
||||
}
|
||||
|
||||
#[Route('/api/map/get_all_floors/')]
|
||||
public function get_all_floors(SiteRepository $sRep): JsonResponse
|
||||
{
|
||||
$sites = $sRep->allSites();
|
||||
$response = array();
|
||||
foreach ($sites as $s) {
|
||||
$siteJSON = array();
|
||||
foreach ($s->getBuildings() as $b) {
|
||||
$buildJSON = array();
|
||||
foreach ($b->getFloors() as $f){
|
||||
$buildJSON[] = array(['name' => $f->getName(), 'id' => $f->getId()]);
|
||||
}
|
||||
$siteJSON[] = array(['name' => $b->getName(), 'id' => $b->getId(), 'floors' => $buildJSON]);
|
||||
}
|
||||
$response[] = array(['name' => $s->getName(), 'id' => $s->getId(), 'building' => $siteJSON]);
|
||||
}
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
#[Route('/api/map/find_place_by_name/{name}')]
|
||||
public function find_place_by_name(PlaceRepository $rep, string $name): JsonResponse
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user