Browse Source

fixed null data array to empty array

tags/0.1.3^0
Robin Thoni 9 years ago
parent
commit
716f194b88
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      src/Generator/sp.php.twig

+ 4
- 0
src/Generator/sp.php.twig View File

49
         $values = DB::select('SELECT (SELECT count(*) FROM {{ spcall }}) as count, (SELECT json_agg(q) FROM (SELECT * FROM {{ spcall }} OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
49
         $values = DB::select('SELECT (SELECT count(*) FROM {{ spcall }}) as count, (SELECT json_agg(q) FROM (SELECT * FROM {{ spcall }} OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
50
             array({{ argsarray }}, ":page" => $page, ":perPage" => $perPage));
50
             array({{ argsarray }}, ":page" => $page, ":perPage" => $perPage));
51
         $value = $values[0];
51
         $value = $values[0];
52
+        if (is_null($value->data))
53
+        {
54
+            $value->data = '[]';
55
+        }
52
         $data = LuStringUtils::convertJsonString($value->data);
56
         $data = LuStringUtils::convertJsonString($value->data);
53
         return new LuMultipleDbo($value->count, $data);
57
         return new LuMultipleDbo($value->count, $data);
54
     }
58
     }

Loading…
Cancel
Save