Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
23 / 23 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| SystemLogsTable | |
100.00% |
23 / 23 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| initialize | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| validationDefault | |
100.00% |
18 / 18 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | |
| 4 | namespace App\Model\Table; |
| 5 | |
| 6 | use Cake\ORM\Table; |
| 7 | use Cake\Validation\Validator; |
| 8 | |
| 9 | /** |
| 10 | * SystemLogs Model |
| 11 | * |
| 12 | * @method \App\Model\Entity\SystemLog newEmptyEntity() |
| 13 | * @method \App\Model\Entity\SystemLog newEntity(array $data, array $options = []) |
| 14 | * @method array<\App\Model\Entity\SystemLog> newEntities(array $data, array $options = []) |
| 15 | * @method \App\Model\Entity\SystemLog get(mixed $primaryKey, array|string $finder = 'all', \Psr\SimpleCache\CacheInterface|string|null $cache = null, \Closure|string|null $cacheKey = null, mixed ...$args) |
| 16 | * @method \App\Model\Entity\SystemLog findOrCreate($search, ?callable $callback = null, array $options = []) |
| 17 | * @method \App\Model\Entity\SystemLog patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = []) |
| 18 | * @method array<\App\Model\Entity\SystemLog> patchEntities(iterable $entities, array $data, array $options = []) |
| 19 | * @method \App\Model\Entity\SystemLog|false save(\Cake\Datasource\EntityInterface $entity, array $options = []) |
| 20 | * @method \App\Model\Entity\SystemLog saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = []) |
| 21 | * @method iterable<\App\Model\Entity\SystemLog>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\SystemLog>|false saveMany(iterable $entities, array $options = []) |
| 22 | * @method iterable<\App\Model\Entity\SystemLog>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\SystemLog> saveManyOrFail(iterable $entities, array $options = []) |
| 23 | * @method iterable<\App\Model\Entity\SystemLog>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\SystemLog>|false deleteMany(iterable $entities, array $options = []) |
| 24 | * @method iterable<\App\Model\Entity\SystemLog>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\SystemLog> deleteManyOrFail(iterable $entities, array $options = []) |
| 25 | * @mixin \Cake\ORM\Behavior\TimestampBehavior |
| 26 | */ |
| 27 | class SystemLogsTable extends Table |
| 28 | { |
| 29 | /** |
| 30 | * Initialize method |
| 31 | * |
| 32 | * @param array<string, mixed> $config The configuration for the Table. |
| 33 | * @return void |
| 34 | */ |
| 35 | public function initialize(array $config): void |
| 36 | { |
| 37 | parent::initialize($config); |
| 38 | |
| 39 | $this->setTable('system_logs'); |
| 40 | $this->setDisplayField('level'); |
| 41 | $this->setPrimaryKey('id'); |
| 42 | |
| 43 | $this->addBehavior('Timestamp'); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Default validation rules. |
| 48 | * |
| 49 | * @param \Cake\Validation\Validator $validator Validator instance. |
| 50 | * @return \Cake\Validation\Validator |
| 51 | */ |
| 52 | public function validationDefault(Validator $validator): Validator |
| 53 | { |
| 54 | $validator |
| 55 | ->scalar('level') |
| 56 | ->maxLength('level', 50) |
| 57 | ->requirePresence('level', 'create') |
| 58 | ->notEmptyString('level'); |
| 59 | |
| 60 | $validator |
| 61 | ->scalar('message') |
| 62 | ->requirePresence('message', 'create') |
| 63 | ->notEmptyString('message'); |
| 64 | |
| 65 | $validator |
| 66 | ->scalar('context') |
| 67 | ->allowEmptyString('context'); |
| 68 | |
| 69 | $validator |
| 70 | ->scalar('group_name') |
| 71 | ->maxLength('group_name', 100) |
| 72 | ->requirePresence('group_name', 'create') |
| 73 | ->notEmptyString('group_name'); |
| 74 | |
| 75 | return $validator; |
| 76 | } |
| 77 | } |