From ac9d31a5f49a901fd027970c3248366c775a5735 Mon Sep 17 00:00:00 2001 From: JiaJia Ji Date: Wed, 9 Oct 2024 09:42:14 +0200 Subject: [PATCH] target only fieldName key --- src/Mapping/DataTarget/Direct.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mapping/DataTarget/Direct.php b/src/Mapping/DataTarget/Direct.php index b8579e8..50ca857 100644 --- a/src/Mapping/DataTarget/Direct.php +++ b/src/Mapping/DataTarget/Direct.php @@ -152,13 +152,13 @@ protected function checkAssignData($newData, $valueContainer, $getter) $fieldName = $fieldNameParts[2]; } - try { + if ($this->fieldName === 'key'){ + $currentDataIsEmpty = empty($currentData); + $newDataIsEmpty = empty($newData); + } else { $fieldDefinition = $this->getFieldDefinition($valueContainer, $fieldName); $currentDataIsEmpty = $fieldDefinition->isEmpty($currentData); $newDataIsEmpty = $fieldDefinition->isEmpty($newData); - } catch (InvalidConfigurationException $e) { - $currentDataIsEmpty = empty($currentData); - $newDataIsEmpty = empty($newData); } if ($this->writeIfTargetIsNotEmpty === false && !$currentDataIsEmpty) {