cerebrate/src/Model/Table/MetaTemplateFieldsTable.php

32 lines
783 B
PHP
Raw Normal View History

<?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'
);
$this->hasMany('MetaFields');
$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;
}
}