| Conditions | 1 |
| Paths | 1 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 1.0019 |
| Changes | 0 | ||
| 1 | <?php |
||
| 60 | 1 | protected function beforeInsert() |
|
| 61 | { |
||
| 62 | // unique validator |
||
| 63 | 1 | $this->addValidator( |
|
| 64 | 1 | 'key', |
|
| 65 | 1 | v::callback(function () { |
|
| 66 | return !$this->getTable()->findRowWhere(['key' => $this->key, 'namespace' => $this->namespace]); |
||
| 67 | 1 | })->setError('Key name "{{input}}" already exists') |
|
| 68 | 1 | ); |
|
| 69 | 1 | } |
|
| 70 | |||
| 79 |