Add floorName to get_floor

This commit is contained in:
Kouril42 2023-02-22 19:12:42 +01:00
parent e834445728
commit 9cee47b80a

View File

@ -94,22 +94,23 @@ class MapApiController extends AbstractController
$jsonPlaces = array();
if ($representation == 'Cylinder' || $representation == 'PolySurface'){
foreach ($places as $place){
$connectedFloors = new ArrayCollection();
$connectedFloors[] = $floor->getId();
$connectedFloors = array();
$seen = new ArrayCollection();
$seen[] = $floor->getId();
foreach ($place->getConnectedPlaces() as $cp) {
foreach ($cp->getFloors() as $cf) {
if (!$connectedFloors->contains($cf->getId())){
if (!$seen->contains($cf->getId())){
$connectedFloors[] = array('id' => $cf->getId(), 'name' => $cf->getName());
$seen[] = $cf->getId();
}
}
}
$connectedFloors->removeElement($floor->getId());
$jsonPlaces[] = array(
'id' => $place->getId(),
'names' => $place->getJoinedNames(),
'type' => $place->getType(),
'surface' => $place->getTwoDRepresentation($representation, $floor->getAltitude()),
'connectedFloors' => $connectedFloors->toArray() #$rep->getFloorsIdConnectedToPlaceID($place->getId()) // Will be added later
'connectedFloors' => $connectedFloors #$rep->getFloorsIdConnectedToPlaceID($place->getId()) // Will be added later
);
}
}