From f201d4811246e6bc6ed425f3a0f0eea8f46d78fc Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 17 Sep 2019 19:42:28 +0300 Subject: [PATCH] Fixed Flex Object saving causing the key to be lost for some types --- system/src/Grav/Framework/Flex/FlexObject.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/src/Grav/Framework/Flex/FlexObject.php b/system/src/Grav/Framework/Flex/FlexObject.php index 826769beb..7cd6ea57e 100644 --- a/system/src/Grav/Framework/Flex/FlexObject.php +++ b/system/src/Grav/Framework/Flex/FlexObject.php @@ -653,9 +653,13 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface } $storageKey = $meta['storage_key'] ?? (string)key($result); - if ($value && $storageKey) { - $this->setStorageKey($storageKey); - $this->setKey($meta['key'] ?? $storageKey); + if ($value) { + if ($storageKey) { + $this->setStorageKey($storageKey); + } + + $newKey = $meta['key'] ?? ($this->hasKey() ? $this->getKey() : null); + $this->setKey($newKey ?? $storageKey); } // FIXME: For some reason locator caching isn't cleared for the file, investigate!