From 41e425cfa270a240fd27932702de47953e447f03 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 15 Nov 2022 14:54:44 +0100 Subject: [PATCH] new: [metaTemplateField] Added `index_type` virtual property to use the correct index_table element --- src/Model/Entity/MetaTemplateField.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Model/Entity/MetaTemplateField.php b/src/Model/Entity/MetaTemplateField.php index 1a355d8..958c3de 100644 --- a/src/Model/Entity/MetaTemplateField.php +++ b/src/Model/Entity/MetaTemplateField.php @@ -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() {