Maurits van der Schee 5 anni fa
parent
commit
a765500178

+ 1
- 1
src/Tqdev/PhpCrudApi/Middleware/JoinLimitsMiddleware.php Vedi File

@@ -46,7 +46,7 @@ class JoinLimitsMiddleware extends Middleware
46 46
                 }
47 47
             }
48 48
             $params['join'] = $joinPaths;
49
-            $request->setParams($params);
49
+            $request = RequestUtils::setParams($request, $params);
50 50
             VariableStore::set("joinLimits.maxRecords", $maxRecords);
51 51
         }
52 52
         return $this->next->handle($request);

+ 1
- 1
src/Tqdev/PhpCrudApi/Middleware/PageLimitsMiddleware.php Vedi File

@@ -42,7 +42,7 @@ class PageLimitsMiddleware extends Middleware
42 42
             } else {
43 43
                 $params['size'] = array(min($params['size'][0], $maxSize));
44 44
             }
45
-            $request->setParams($params);
45
+            $request = RequestUtils::setParams($request, $params);
46 46
         }
47 47
         return $this->next->handle($request);
48 48
     }

+ 13
- 0
src/Tqdev/PhpCrudApi/RequestUtils.php Vedi File

@@ -6,6 +6,11 @@ use Tqdev\PhpCrudApi\Column\ReflectionService;
6 6
 
7 7
 class RequestUtils
8 8
 {
9
+    public static function setParams(ServerRequestInterface $request, array $params): ServerRequestInterface
10
+    {
11
+        return $request->withUri($request->getUri()->withQuery(http_build_query($params)));
12
+    }
13
+
9 14
     public static function getHeader(ServerRequestInterface $request, string $header): string
10 15
     {
11 16
         $headers = $request->getHeader($header);
@@ -16,8 +21,16 @@ class RequestUtils
16 21
     {
17 22
         $params = array();
18 23
         $query = $request->getUri()->getQuery();
24
+        if ($query) {
25
+            die(var_dump($query));
26
+        }
27
+
19 28
         $query = str_replace('][]=', ']=', str_replace('=', '[]=', $query));
20 29
         parse_str($query, $params);
30
+        if ($params) {
31
+            die(var_dump($params));
32
+        }
33
+
21 34
         return $params;
22 35
     }
23 36
 

Loading…
Annulla
Salva