Total Complexity | 8 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Coverage | 82.14% |
Changes | 0 |
1 | <?php |
||
10 | abstract class SqlRepository extends AbstractRepository |
||
11 | { |
||
12 | /** |
||
13 | * {@inheritDoc} |
||
14 | */ |
||
15 | 3 | public function all($columns = ['*']) |
|
16 | { |
||
17 | 3 | return parent::all( |
|
18 | 3 | $this->getColumnNames($columns) |
|
19 | ); |
||
20 | } |
||
21 | |||
22 | /** |
||
23 | * {@inheritDoc} |
||
24 | */ |
||
25 | 1 | public function paginate(int $perPage = null, $columns = ['*']) |
|
26 | { |
||
27 | 1 | return parent::paginate( |
|
28 | 1 | $perPage, |
|
29 | 1 | $this->getColumnNames($columns) |
|
30 | ); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritDoc} |
||
35 | */ |
||
36 | 1 | public function simplePaginate(int $perPage = null, $columns = ['*']) |
|
37 | { |
||
38 | 1 | return parent::simplePaginate( |
|
39 | 1 | $perPage, |
|
40 | 1 | $this->getColumnNames($columns) |
|
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritDoc} |
||
46 | */ |
||
47 | 3 | public function find($id, $columns = ['*']) |
|
48 | { |
||
49 | 3 | return parent::find( |
|
50 | 3 | $id, |
|
51 | 3 | $this->getColumnNames($columns) |
|
52 | ); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * {@inheritDoc} |
||
57 | */ |
||
58 | public function findByField($field, $value = null, $columns = ['*']) |
||
59 | { |
||
60 | return parent::findByField( |
||
61 | $this->getColumnName($field), |
||
62 | $value, |
||
63 | $this->getColumnNames($columns) |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritDoc} |
||
69 | */ |
||
70 | 1 | public function first($columns = ['*']): ?Model |
|
74 | ); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @param string $column |
||
79 | * @param mixed $model |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 9 | public function getColumnName($column, $model = null): string |
|
90 | } |
||
91 | } |
||
92 |