diff --git a/CHANGELOG.md b/CHANGELOG.md index ae78708..2d98da2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## 1.13.0 * feat: `Map(property: null)` ignores the mapping +* fix: only remove source property mapping if it maps to the same name on the + target side ## 1.12.0 diff --git a/src/Transformer/MetadataUtil/PropertyMappingResolver/PropertyMappingResolver.php b/src/Transformer/MetadataUtil/PropertyMappingResolver/PropertyMappingResolver.php index 1525255..f068715 100644 --- a/src/Transformer/MetadataUtil/PropertyMappingResolver/PropertyMappingResolver.php +++ b/src/Transformer/MetadataUtil/PropertyMappingResolver/PropertyMappingResolver.php @@ -69,7 +69,7 @@ class: $sourceClass, } if ($targetProperty === null) { - if (isset($targetPropertyToSourceProperty[$sourceProperty])) { + if (($targetPropertyToSourceProperty[$sourceProperty] ?? null) === $sourceProperty) { unset($targetPropertyToSourceProperty[$sourceProperty]); }