Ver código fonte

LuMultipleDbo

tags/0.1.0
Robin Thoni 9 anos atrás
pai
commit
5dd7f81549
2 arquivos alterados com 47 adições e 1 exclusões
  1. 1
    1
      src/Utils/LuDataAccess.php
  2. 46
    0
      src/Utils/LuMutlipleDbo.php

+ 1
- 1
src/Utils/LuDataAccess.php Ver arquivo

@@ -153,6 +153,6 @@ abstract class LuDataAccess {
153 153
         $data = $model->take($perPage)->offset($page * $perPage)->get();
154 154
         $dbo = self::arrayToDbo($data);
155 155
 
156
-        return array("Count" => $count, "Data" => $dbo);
156
+        return new LuMultipleBdo($count, $dbo);
157 157
     }
158 158
 }

+ 46
- 0
src/Utils/LuMutlipleDbo.php Ver arquivo

@@ -0,0 +1,46 @@
1
+<?php
2
+
3
+namespace Luticate\Utils;
4
+
5
+class LuMultipleBdo implements \JsonSerializable {
6
+
7
+    /**
8
+     * @var int
9
+     */
10
+    private $_count;
11
+    public function setCount($count)
12
+    {
13
+        $this->_count = $count;
14
+    }
15
+    public function getCount()
16
+    {
17
+        return $this->_count;
18
+    }
19
+
20
+    /**
21
+     * @var array
22
+     */
23
+    private $_data;
24
+    public function setData($data)
25
+    {
26
+        $this->_data = $data;
27
+    }
28
+    public function getData()
29
+    {
30
+        return $this->_data;
31
+    }
32
+
33
+    function jsonSerialize()
34
+    {
35
+        return array(
36
+            "Count" => $this->_count,
37
+            "Data" => $this->_data
38
+        );
39
+    }
40
+
41
+    function __construct($count = 0, $data = array())
42
+    {
43
+        $this->_count = $count;
44
+        $this->_data = $data;
45
+    }
46
+}

Carregando…
Cancelar
Salvar