From d5ee7c19ea4cbce32d87d77741dba4f0421274c4 Mon Sep 17 00:00:00 2001 From: Chase Giunta Date: Sat, 25 Sep 2021 12:16:45 -0500 Subject: [PATCH] Fix column not found errors for predefined fields created on Craft 3.7+ --- src/fields/BasePredefinedField.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fields/BasePredefinedField.php b/src/fields/BasePredefinedField.php index 71bee07..827bd89 100644 --- a/src/fields/BasePredefinedField.php +++ b/src/fields/BasePredefinedField.php @@ -11,6 +11,7 @@ use craft\base\Element; use craft\base\Field; use craft\base\PreviewableFieldInterface; +use craft\helpers\ElementHelper; use Exception; use Throwable; @@ -67,6 +68,10 @@ public function processFieldValues($element, $isNew) $fieldColumnPrefix = $element->getFieldColumnPrefix(); $column = $fieldColumnPrefix.$this->handle; + if (version_compare(Craft::$app->version, '3.7.0', '>=')) { + $column = ElementHelper::fieldColumnFromField($this); + } + Craft::$app->db->createCommand() ->update( $element->contentTable,