mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-03-17 14:41:03 +01:00
Add P,F,B,S names to find_place_by_name
This commit is contained in:
parent
68135b4567
commit
679adf5bb4
13
API.md
13
API.md
@ -99,9 +99,18 @@ __Format of the dict :__
|
||||
[
|
||||
{
|
||||
'idPlace':int, //unique id of the place
|
||||
'namePlace':string[], //list of Names of the place
|
||||
'idSite': int, //id of the place Site
|
||||
'idBuilding': int, //id of the place Building
|
||||
'idFloors': int[] //list of every floorID the place is in
|
||||
'nameSite' : string, //name of the Site
|
||||
'idBuilding': int, //id of the Building
|
||||
'nameBuilding': string, //name of the Building
|
||||
'floors': [ //list of every {floorID, floorName} the place is in
|
||||
{
|
||||
'name': string, //name of the first floor of the building
|
||||
'id' : int //its id
|
||||
},
|
||||
{...}
|
||||
]
|
||||
},
|
||||
{...}
|
||||
]
|
||||
|
||||
@ -94,18 +94,12 @@ class MapApiController extends AbstractController
|
||||
$jsonPlaces = array();
|
||||
if ($representation == 'Cylinder' || $representation == 'PolySurface'){
|
||||
foreach ($places as $place){
|
||||
$connectedFloors = array();
|
||||
foreach ($place->getFloors() as $f) {
|
||||
if ($f->getId() != $id) {
|
||||
$connectedFloors[] = array('id' => $f->getId(), 'name' => $f->getName());
|
||||
}
|
||||
}
|
||||
$jsonPlaces[] = array(
|
||||
'id' => $place->getId(),
|
||||
'names' => $place->getJoinedNames(),
|
||||
'type' => $place->getType(),
|
||||
'surface' => $place->getTwoDRepresentation($representation, $floor->getAltitude()),
|
||||
'connectedFloors' => $connectedFloors #$rep->getFloorsIdConnectedToPlaceID($place->getId()) // Will be added later
|
||||
'connectedFloors' => $place->getFloorsNameAndId() #$rep->getFloorsIdConnectedToPlaceID($place->getId()) // Will be added later
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -147,16 +141,19 @@ class MapApiController extends AbstractController
|
||||
{
|
||||
$result = array();
|
||||
foreach ($rep->findPlaceByName($name) as $place){
|
||||
$floorsId = array();
|
||||
$floors = array();
|
||||
foreach ($place->getFloors() as $floor) {
|
||||
$floorsId[] = $floor->getId();
|
||||
$floors[] = $floor->getId();
|
||||
}
|
||||
$building = $place->getFloors()[0]->getBuilding();
|
||||
$result[] = array(
|
||||
'idRoom' => $place->getId(),
|
||||
'idPlace' => $place->getId(),
|
||||
'namePlace' => $place->getJoinedNames(),
|
||||
'idSite' => $building->getSite()->getId(),
|
||||
'nameSite' => $building->getSite()->getName(),
|
||||
'idBuilding' => $building->getId(),
|
||||
'idFloors' => $floorsId
|
||||
'nameBuilding' => $building->getName(),
|
||||
'floors' => $place->getFloorsNameAndId()
|
||||
);
|
||||
}
|
||||
return $this->json($result);
|
||||
|
||||
@ -165,6 +165,14 @@ class Place
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
public function getFloorsNameAndId(): array
|
||||
{
|
||||
$response = array();
|
||||
foreach ($this->floors as $f) {
|
||||
$response[] = array('id' => $f->getId(), 'name' => $f->getName());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function addFloor(Floor $floor): self
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user