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