Explorar o código

Enhancement: support multiple GET parameters for the SORT command (see also my comment in ISSUE #1)

Daniele Alessandri %!s(int64=15) %!d(string=hai) anos
pai
achega
6e3b1c835d
Modificáronse 1 ficheiros con 9 adicións e 1 borrados
  1. 9 1
      lib/Predis.php

+ 9 - 1
lib/Predis.php

@@ -1461,7 +1461,15 @@ class Sort extends \Predis\InlineCommand {
             $query[] = 'BY ' . $sortParams['by'];
         }
         if (isset($sortParams['get'])) {
-            $query[] = 'GET ' . $sortParams['get'];
+            $getargs = $sortParams['get'];
+            if (is_array($getargs)) {
+                foreach ($getargs as $getarg) {
+                    $query[] = 'GET ' . $getarg;
+                }
+            }
+            else {
+                $query[] = 'GET ' . $getargs;
+            }
         }
         if (isset($sortParams['limit']) && is_array($sortParams['limit'])) {
             $query[] = 'LIMIT ' . $sortParams['limit'][0] . ' ' . $sortParams['limit'][1];