bluzphp /
skeleton
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * @copyright Bluz PHP Team |
||
| 5 | * @link https://github.com/bluzphp/skeleton |
||
| 6 | */ |
||
| 7 | |||
| 8 | declare(strict_types=1); |
||
| 9 | |||
| 10 | namespace Application\Roles; |
||
| 11 | |||
| 12 | use Bluz\Validator\Traits\Validator; |
||
|
0 ignored issues
–
show
|
|||
| 13 | |||
| 14 | /** |
||
| 15 | * Row of User Role |
||
| 16 | * |
||
| 17 | * @package Application\Roles |
||
| 18 | * |
||
| 19 | * @property integer $id |
||
| 20 | * @property string $name |
||
| 21 | */ |
||
| 22 | class Row extends \Bluz\Db\Row |
||
|
0 ignored issues
–
show
The type
Bluz\Db\Row was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 23 | { |
||
| 24 | use Validator; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * {@inheritdoc} |
||
| 28 | * |
||
| 29 | * @throws \Bluz\Validator\Exception\ComponentException |
||
| 30 | */ |
||
| 31 | protected function beforeInsert(): void |
||
| 32 | { |
||
| 33 | $this->addValidator('name') |
||
| 34 | ->required() |
||
| 35 | ->latin() |
||
| 36 | ->callback( |
||
| 37 | function ($name) { |
||
| 38 | return !Table::findRowWhere(['name' => $name]); |
||
| 39 | } |
||
| 40 | ) |
||
| 41 | ->setDescription('Role already exists'); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | * |
||
| 47 | * @throws \Bluz\Validator\Exception\ComponentException |
||
| 48 | */ |
||
| 49 | protected function beforeUpdate(): void |
||
| 50 | { |
||
| 51 | $this->addValidator('name') |
||
| 52 | ->required() |
||
| 53 | ->latin() |
||
| 54 | ->callback( |
||
| 55 | function ($name) { |
||
| 56 | return !in_array(strtolower($name), Table::getInstance()->getBasicRoles(), false); |
||
| 57 | }, |
||
| 58 | 'Role is basic and can\'t be editable' |
||
| 59 | ) |
||
| 60 | ->callback( |
||
| 61 | function ($name) { |
||
| 62 | return $this->clean['name'] !== $name; |
||
| 63 | }, |
||
| 64 | 'Role name is the same as original' |
||
| 65 | ) |
||
| 66 | ->callback( |
||
| 67 | function ($name) { |
||
| 68 | return !Table::findRowWhere(['name' => $name]); |
||
| 69 | }, |
||
| 70 | 'Role already exists' |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | |||
| 74 | /** |
||
| 75 | * isBasic |
||
| 76 | * |
||
| 77 | * @return boolean |
||
| 78 | 1 | */ |
|
| 79 | public function isBasic(): bool |
||
| 80 | 1 | { |
|
| 81 | return in_array(strtolower($this->name), Table::getInstance()->getBasicRoles(), false); |
||
| 82 | } |
||
| 83 | } |
||
| 84 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths