Espinoza Guillermo hace 7 años
padre
commit
b978807806
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      Twig/GetJSONExtension.php

+ 7 - 2
Twig/GetJSONExtension.php

@@ -36,13 +36,18 @@ class GetJSONExtension extends \Twig_Extension
     /**
     /**
      * @param int $clientId
      * @param int $clientId
      *
      *
-     * @return string
+     * @return array
      */
      */
     public function getJSON($parameter = 'client', $filters = [])
     public function getJSON($parameter = 'client', $filters = [])
     {
     {
         $url = $this->webservice->buildUrl($parameter, $filters);
         $url = $this->webservice->buildUrl($parameter, $filters);
+        $result = json_decode($this->webservice->makeGetRequest($url), true);
+
+        if ($result) {
+            return current(json_decode($this->webservice->makeGetRequest($url), true));
+        }
 
 
-        return current(json_decode($this->webservice->makeGetRequest($url), true));
+        return [];
     }
     }
 
 
     /**
     /**