2020-09-28 01:25:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Model\Table;
|
|
|
|
|
|
|
|
use App\Model\Table\AppTable;
|
|
|
|
use Cake\ORM\Table;
|
|
|
|
use Cake\Validation\Validator;
|
|
|
|
|
|
|
|
class MetaTemplateFieldsTable extends AppTable
|
|
|
|
{
|
|
|
|
public function initialize(array $config): void
|
|
|
|
{
|
|
|
|
parent::initialize($config);
|
|
|
|
$this->BelongsTo(
|
|
|
|
'MetaTemplates'
|
|
|
|
);
|
2020-12-08 09:07:48 +01:00
|
|
|
$this->hasMany('MetaFields');
|
2020-09-28 01:25:07 +02:00
|
|
|
$this->setDisplayField('field');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function validationDefault(Validator $validator): Validator
|
|
|
|
{
|
|
|
|
$validator
|
|
|
|
->notEmptyString('field')
|
|
|
|
->notEmptyString('type')
|
|
|
|
->numeric('meta_template_id')
|
|
|
|
->notBlank('meta_template_id')
|
|
|
|
->requirePresence(['meta_template_id', 'field', 'type'], 'create');
|
|
|
|
return $validator;
|
|
|
|
}
|
|
|
|
}
|