|
@@ -26,6 +26,21 @@ abstract class LuDataAccess {
|
26
|
26
|
return $this->model;
|
27
|
27
|
}
|
28
|
28
|
|
|
29
|
+ /**
|
|
30
|
+ * @param $data LuModel[]
|
|
31
|
+ * @return LuDbo[]
|
|
32
|
+ */
|
|
33
|
+ protected function arrayToDbo($data)
|
|
34
|
+ {
|
|
35
|
+ $tab = [];
|
|
36
|
+ foreach ($data as $q) {
|
|
37
|
+ if (!is_null($q)) {
|
|
38
|
+ $tab[] = $q->toDbo();
|
|
39
|
+ }
|
|
40
|
+ }
|
|
41
|
+ return $tab;
|
|
42
|
+ }
|
|
43
|
+
|
29
|
44
|
/**
|
30
|
45
|
* @param $page int
|
31
|
46
|
* @param $perPage int
|
|
@@ -43,11 +58,7 @@ abstract class LuDataAccess {
|
43
|
58
|
|
44
|
59
|
$data = $data->orderBy($column, $order)->take($perPage)->offset($page * $perPage)->get();
|
45
|
60
|
|
46
|
|
- $tab = [];
|
47
|
|
- /* @var $data LuModel[] */
|
48
|
|
- foreach ($data as $q) {
|
49
|
|
- $tab[] = $q->toDbo();
|
50
|
|
- }
|
|
61
|
+ $tab = $this->arrayToDbo($data);
|
51
|
62
|
return $tab;
|
52
|
63
|
}
|
53
|
64
|
|