new: [metaTemplateField] Added `index_type` virtual property to use the correct index_table element

pull/121/head
Sami Mokaddem 2022-11-15 14:54:44 +01:00
parent a9ef415f9d
commit 41e425cfa2
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 14 additions and 1 deletions

View File

@ -7,7 +7,20 @@ use Cake\ORM\Entity;
class MetaTemplateField extends AppModel
{
protected $_virtual = ['form_type', 'form_options', ];
protected $_virtual = ['index_type', 'form_type', 'form_options', ];
protected function _getIndexType()
{
$indexType = 'text';
if ($this->type === 'boolean') {
$indexType = 'boolean';
} else if ($this->type === 'date') {
$indexType = 'datetime';
} else if ($this->type === 'ipv4' || $this->type === 'ipv6') {
$indexType = 'text';
}
return $indexType;
}
protected function _getFormType()
{