| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | trait Model |
||
| 24 | { |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @inheritDoc |
||
| 28 | * @throws \Quantum\Exceptions\DatabaseException |
||
| 29 | */ |
||
| 30 | public function create(): DbalInterface |
||
| 31 | { |
||
| 32 | $this->getOrmModel()->create(); |
||
|
|
|||
| 33 | return $this; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @inheritDoc |
||
| 38 | * @throws \Quantum\Exceptions\DatabaseException |
||
| 39 | */ |
||
| 40 | public function prop(string $key, $value = null) |
||
| 41 | { |
||
| 42 | if ($value) { |
||
| 43 | $this->getOrmModel()->$key = $value; |
||
| 44 | } else { |
||
| 45 | return $this->getOrmModel()->$key ?? null; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @inheritDoc |
||
| 51 | * @throws \Quantum\Exceptions\DatabaseException |
||
| 52 | */ |
||
| 53 | public function save(): bool |
||
| 54 | { |
||
| 55 | return $this->getOrmModel()->save(); |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @inheritDoc |
||
| 60 | * @throws \Quantum\Exceptions\DatabaseException |
||
| 61 | */ |
||
| 62 | public function delete(): bool |
||
| 63 | { |
||
| 64 | return $this->getOrmModel()->delete(); |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @inheritDoc |
||
| 69 | * @throws \Quantum\Exceptions\DatabaseException |
||
| 70 | */ |
||
| 71 | public function deleteMany(): bool |
||
| 74 | } |
||
| 75 | |||
| 76 | } |