Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
26.67% |
4 / 15 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ArticlesTranslationsTable | |
26.67% |
4 / 15 |
|
50.00% |
1 / 2 |
3.58 | |
0.00% |
0 / 1 |
| initialize | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| validationDefault | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 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 | * ArticlesTranslations Model |
| 11 | * |
| 12 | * @method \App\Model\Entity\ArticlesTranslation newEmptyEntity() |
| 13 | * @method \App\Model\Entity\ArticlesTranslation newEntity(array $data, array $options = []) |
| 14 | * @method array<\App\Model\Entity\ArticlesTranslation> newEntities(array $data, array $options = []) |
| 15 | * @method \App\Model\Entity\ArticlesTranslation 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\ArticlesTranslation findOrCreate($search, ?callable $callback = null, array $options = []) |
| 17 | * @method \App\Model\Entity\ArticlesTranslation patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = []) |
| 18 | * @method array<\App\Model\Entity\ArticlesTranslation> patchEntities(iterable $entities, array $data, array $options = []) |
| 19 | * @method \App\Model\Entity\ArticlesTranslation|false save(\Cake\Datasource\EntityInterface $entity, array $options = []) |
| 20 | * @method \App\Model\Entity\ArticlesTranslation saveOrFail(\Cake\Datasource\EntityInterface $entity, array $options = []) |
| 21 | * @method iterable<\App\Model\Entity\ArticlesTranslation>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ArticlesTranslation>|false saveMany(iterable $entities, array $options = []) |
| 22 | * @method iterable<\App\Model\Entity\ArticlesTranslation>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ArticlesTranslation> saveManyOrFail(iterable $entities, array $options = []) |
| 23 | * @method iterable<\App\Model\Entity\ArticlesTranslation>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ArticlesTranslation>|false deleteMany(iterable $entities, array $options = []) |
| 24 | * @method iterable<\App\Model\Entity\ArticlesTranslation>|\Cake\Datasource\ResultSetInterface<\App\Model\Entity\ArticlesTranslation> deleteManyOrFail(iterable $entities, array $options = []) |
| 25 | */ |
| 26 | class ArticlesTranslationsTable extends Table |
| 27 | { |
| 28 | /** |
| 29 | * Initialize method |
| 30 | * |
| 31 | * @param array<string, mixed> $config The configuration for the Table. |
| 32 | * @return void |
| 33 | */ |
| 34 | public function initialize(array $config): void |
| 35 | { |
| 36 | parent::initialize($config); |
| 37 | |
| 38 | $this->setTable('articles_translations'); |
| 39 | $this->setDisplayField('title'); |
| 40 | $this->setPrimaryKey(['id', 'locale']); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Default validation rules. |
| 45 | * |
| 46 | * @param \Cake\Validation\Validator $validator Validator instance. |
| 47 | * @return \Cake\Validation\Validator |
| 48 | */ |
| 49 | public function validationDefault(Validator $validator): Validator |
| 50 | { |
| 51 | $validator |
| 52 | ->scalar('title') |
| 53 | ->maxLength('title', 255) |
| 54 | ->allowEmptyString('title'); |
| 55 | |
| 56 | $validator |
| 57 | ->scalar('body') |
| 58 | ->allowEmptyString('body'); |
| 59 | |
| 60 | $validator |
| 61 | ->scalar('summary') |
| 62 | ->allowEmptyString('summary'); |
| 63 | |
| 64 | return $validator; |
| 65 | } |
| 66 | } |