From 0ac33336bd9178002c558a01acec195a7cd30599 Mon Sep 17 00:00:00 2001 From: Robbie Averill Date: Fri, 7 Sep 2018 12:50:34 +0200 Subject: [PATCH] FIX Do not remap polymorphic class names to UserDefinedForm if they are already an instance of it --- code/Extension/UpgradePolymorphicExtension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/Extension/UpgradePolymorphicExtension.php b/code/Extension/UpgradePolymorphicExtension.php index 6bf79d4..e8073a9 100644 --- a/code/Extension/UpgradePolymorphicExtension.php +++ b/code/Extension/UpgradePolymorphicExtension.php @@ -71,6 +71,11 @@ class UpgradePolymorphicExtension extends DataExtension continue; } + // Don't rewrite class values when an existing value is set and is an instance of UserDefinedForm + if ($relationshipObject instanceof UserDefinedForm) { + continue; + } + $entry->$fieldName = $this->defaultReplacement; try { $entry->write();