Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
76.92% |
10 / 13 |
|
50.00% |
2 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Permission | |
76.92% |
10 / 13 |
|
50.00% |
2 / 4 |
5.31 | |
0.00% |
0 / 1 |
| getEntityMapping | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| addOrderByName | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| addConditionName | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| addConditionNames | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
2.06 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace BO\Zmsdb\Query; |
| 4 | |
| 5 | class Permission extends Base implements MappingInterface |
| 6 | { |
| 7 | /** |
| 8 | * @var string TABLE mysql table reference |
| 9 | */ |
| 10 | const TABLE = 'permission'; |
| 11 | |
| 12 | #[\Override] |
| 13 | public function getEntityMapping() |
| 14 | { |
| 15 | return [ |
| 16 | 'id' => 'permission.id', |
| 17 | 'name' => 'permission.name', |
| 18 | 'description' => 'permission.description', |
| 19 | ]; |
| 20 | } |
| 21 | |
| 22 | public function addOrderByName(string $order = 'ASC'): self |
| 23 | { |
| 24 | $this->query->orderBy('permission.name', $order); |
| 25 | return $this; |
| 26 | } |
| 27 | |
| 28 | public function addConditionName(string $name): self |
| 29 | { |
| 30 | $this->query->where('permission.name', '=', $name); |
| 31 | return $this; |
| 32 | } |
| 33 | |
| 34 | public function addConditionNames(array $names): self |
| 35 | { |
| 36 | if ($names === []) { |
| 37 | throw new \InvalidArgumentException('Argument $names must not be empty.'); |
| 38 | } |
| 39 | $this->query->whereIn('permission.name', $names); |
| 40 | return $this; |
| 41 | } |
| 42 | } |