From c538a231b709e36f2971aec7971e041151685ac1 Mon Sep 17 00:00:00 2001 From: Christopher Darling Date: Wed, 6 May 2020 10:53:20 +0100 Subject: [PATCH] FIX $record->hasMethod() should be called before getting the relation --- src/TagField.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/TagField.php b/src/TagField.php index 5bbf503..34a5113 100644 --- a/src/TagField.php +++ b/src/TagField.php @@ -380,8 +380,6 @@ class TagField extends MultiSelectField $titleField = $this->getTitleField(); $values = $this->Value(); - /** @var Relation $relation */ - $relation = $record->$name(); $ids = []; if (!$values) { @@ -398,6 +396,9 @@ class TagField extends MultiSelectField ); } + /** @var Relation $relation */ + $relation = $record->$name(); + foreach ($values as $key => $value) { // Get or create record $record = $this->getOrCreateTag($value);