Skip to content

Commit edbb4dc

Browse files
committed
Improve batch read for GeoJSON
1 parent 6c15a5f commit edbb4dc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,9 +2818,9 @@ public function read(ServerRequestInterface $request): ResponseInterface
28182818
$params = RequestUtils::getParams($request);
28192819
if (strpos($id, ',') !== false) {
28202820
$ids = explode(',', $id);
2821-
$result = [];
2821+
$result = (object) array('type' => 'FeatureCollection', 'features' => array());
28222822
for ($i = 0; $i < count($ids); $i++) {
2823-
array_push($result, $this->service->read($table, $ids[$i], $params));
2823+
array_push($result->features, $this->service->read($table, $ids[$i], $params));
28242824
}
28252825
return $this->responder->success($result);
28262826
} else {

src/Tqdev/PhpCrudApi/Controller/GeoJsonController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function read(ServerRequestInterface $request): ResponseInterface
4545
$params = RequestUtils::getParams($request);
4646
if (strpos($id, ',') !== false) {
4747
$ids = explode(',', $id);
48-
$result = [];
48+
$result = (object) array('type' => 'FeatureCollection', 'features' => array());
4949
for ($i = 0; $i < count($ids); $i++) {
50-
array_push($result, $this->service->read($table, $ids[$i], $params));
50+
array_push($result->features, $this->service->read($table, $ids[$i], $params));
5151
}
5252
return $this->responder->success($result);
5353
} else {

0 commit comments

Comments
 (0)