diff --git a/src/Dto2DataConverter.php b/src/Dto2DataConverter.php index 1f2ff2e..2afc1ca 100644 --- a/src/Dto2DataConverter.php +++ b/src/Dto2DataConverter.php @@ -65,6 +65,7 @@ class Dto2DataConverter $value = $this->grabValue($object, $sourceName, $tags); + $canSkip = false; // Если нет карты, то не сериализуем. if (is_iterable($value)) { $childMap = is_array($propertyInfo) ? $propertyInfo : null; @@ -72,10 +73,15 @@ class Dto2DataConverter } elseif (is_object($value) && is_array($propertyInfo)) { $value = $this->convertObjectByMap($value, $propertyInfo, $tags); } elseif (!is_scalar($value) && null !== $value) { - continue; + $canSkip = true; } $this->processIterationTransformers($object, $sourceName, $value, $tags); + + if ($canSkip && !is_scalar($value) && null !== $value) { + continue; + } + $dataPath = $this->grabIterationDataPath($object, $sourceName, $tags); $data[$dataPath] = $value; }