From 088b15fcb8da1fca3b19c64d3a1098dba221c188 Mon Sep 17 00:00:00 2001 From: Michael Krecek Date: Thu, 16 Mar 2023 15:02:43 +0100 Subject: [PATCH 1/5] Fix typecasting --- src/Form/Control/TreeItemSelector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/Control/TreeItemSelector.php b/src/Form/Control/TreeItemSelector.php index 93f6285e1d..91175a7159 100644 --- a/src/Form/Control/TreeItemSelector.php +++ b/src/Form/Control/TreeItemSelector.php @@ -131,7 +131,7 @@ public function getInput() */ public function getValue() { - return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get()); + return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); } protected function renderView(): void From f28ba8732c345d3f4fed04eb5c30f0e64b1e385e Mon Sep 17 00:00:00 2001 From: Michael Krecek Date: Thu, 16 Mar 2023 16:36:23 +0100 Subject: [PATCH 2/5] Fix typecasting json --- src/Form/Control/TreeItemSelector.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Form/Control/TreeItemSelector.php b/src/Form/Control/TreeItemSelector.php index 91175a7159..cc19626236 100644 --- a/src/Form/Control/TreeItemSelector.php +++ b/src/Form/Control/TreeItemSelector.php @@ -131,7 +131,12 @@ public function getInput() */ public function getValue() { - return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); + if (is_scalar($this->entityField->get())) { + return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); + } else { + return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get()); + } + } protected function renderView(): void From 9ff5f8486bf84fa1d3f311bed4761619b3091408 Mon Sep 17 00:00:00 2001 From: Michael Krecek Date: Thu, 16 Mar 2023 16:43:23 +0100 Subject: [PATCH 3/5] Fix CS --- src/Form/Control/TreeItemSelector.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Form/Control/TreeItemSelector.php b/src/Form/Control/TreeItemSelector.php index cc19626236..444eed3f13 100644 --- a/src/Form/Control/TreeItemSelector.php +++ b/src/Form/Control/TreeItemSelector.php @@ -133,10 +133,9 @@ public function getValue() { if (is_scalar($this->entityField->get())) { return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); - } else { - return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get()); } - + + return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get()); } protected function renderView(): void From e914d45f0e83b978061184e3e00fcddcf76de3de Mon Sep 17 00:00:00 2001 From: Michael Krecek Date: Thu, 16 Mar 2023 16:52:21 +0100 Subject: [PATCH 4/5] Fix CS --- src/Form/Control/TreeItemSelector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/Control/TreeItemSelector.php b/src/Form/Control/TreeItemSelector.php index 444eed3f13..e5c1effb40 100644 --- a/src/Form/Control/TreeItemSelector.php +++ b/src/Form/Control/TreeItemSelector.php @@ -134,7 +134,7 @@ public function getValue() if (is_scalar($this->entityField->get())) { return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); } - + return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get()); } From ccda34d5071d303ef1be86f44c6e23d413cf5447 Mon Sep 17 00:00:00 2001 From: Michael Krecek Date: Thu, 16 Mar 2023 17:56:40 +0100 Subject: [PATCH 5/5] Fix scalar handling (non-typecasted), only typecast non-scalars --- src/Form/Control/TreeItemSelector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/Control/TreeItemSelector.php b/src/Form/Control/TreeItemSelector.php index e5c1effb40..b360997246 100644 --- a/src/Form/Control/TreeItemSelector.php +++ b/src/Form/Control/TreeItemSelector.php @@ -132,7 +132,7 @@ public function getInput() public function getValue() { if (is_scalar($this->entityField->get())) { - return $this->getApp()->uiPersistence->typecastLoadField($this->entityField->getField(), $this->entityField->get()); + return $this->entityField->get(); } return $this->getApp()->uiPersistence->typecastSaveField($this->entityField->getField(), $this->entityField->get());