소스 검색

Improve batch read for GeoJSON

Maurits van der Schee 5 년 전
부모
커밋
edbb4dcadb
2개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 2
    2
      api.php
  2. 2
    2
      src/Tqdev/PhpCrudApi/Controller/GeoJsonController.php

+ 2
- 2
api.php 파일 보기

@@ -2818,9 +2818,9 @@ class GeoJsonController
2818 2818
         $params = RequestUtils::getParams($request);
2819 2819
         if (strpos($id, ',') !== false) {
2820 2820
             $ids = explode(',', $id);
2821
-            $result = [];
2821
+            $result = (object) array('type' => 'FeatureCollection', 'features' => array());
2822 2822
             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));
2824 2824
             }
2825 2825
             return $this->responder->success($result);
2826 2826
         } else {

+ 2
- 2
src/Tqdev/PhpCrudApi/Controller/GeoJsonController.php 파일 보기

@@ -45,9 +45,9 @@ class GeoJsonController
45 45
         $params = RequestUtils::getParams($request);
46 46
         if (strpos($id, ',') !== false) {
47 47
             $ids = explode(',', $id);
48
-            $result = [];
48
+            $result = (object) array('type' => 'FeatureCollection', 'features' => array());
49 49
             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));
51 51
             }
52 52
             return $this->responder->success($result);
53 53
         } else {

Loading…
취소
저장