diff --git a/src/Model/Table/MetaFieldsTable.php b/src/Model/Table/MetaFieldsTable.php index cb5c9b7..88affbf 100644 --- a/src/Model/Table/MetaFieldsTable.php +++ b/src/Model/Table/MetaFieldsTable.php @@ -2,7 +2,6 @@ namespace App\Model\Table; -use App\Model\Entity\MetaTemplateField; use App\Model\Table\AppTable; use Cake\ORM\Table; use Cake\Validation\Validator; @@ -66,15 +65,15 @@ class MetaFieldsTable extends AppTable return true; } - public function isValidType($value, MetaTemplateField $metaTemplateField) + public function isValidType($value, $metaTemplateField) { if (empty($value)) { return __('Metafield value cannot be empty.'); } - $typeHandler = $this->MetaTemplateFields->getTypeHandler($metaTemplateField->type); + $typeHandler = $this->MetaTemplateFields->getTypeHandler($metaTemplateField['type']); if (!empty($typeHandler)) { $success = $typeHandler->validate($value); - return $success ? true : __('Metafields value `{0}` for `{1}` doesn\'t pass type validation.', $value, $metaTemplateField->field); + return $success ? true : __('Metafields value `{0}` for `{1}` doesn\'t pass type validation.', $value, $metaTemplateField['field']); } /* We should not end-up in this case. But if someone creates a new type without his handler, @@ -86,9 +85,9 @@ class MetaFieldsTable extends AppTable public function isValidRegex($value, $metaTemplateField) { - $re = $metaTemplateField->regex; + $re = $metaTemplateField['regex']; if (!preg_match("/^$re$/m", $value)) { - return __('Metafield value `{0}` for `{1}` doesn\'t pass regex validation.', $value, $metaTemplateField->field); + return __('Metafield value `{0}` for `{1}` doesn\'t pass regex validation.', $value, $metaTemplateField['field']); } return true; }