|
|
@ -69,26 +69,18 @@ class Dto2DataConverter |
|
|
|
foreach ($map as $key => $propertyInfo) { |
|
|
|
foreach ($map as $key => $propertyInfo) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
$sourceName = is_array($propertyInfo) ? $key : $propertyInfo; |
|
|
|
$sourceName = is_array($propertyInfo) ? $key : $propertyInfo; |
|
|
|
|
|
|
|
|
|
|
|
$value = $this->grabValue($object, $sourceName, $tags); |
|
|
|
$value = $this->grabValue($object, $sourceName, $tags); |
|
|
|
|
|
|
|
|
|
|
|
$canSkip = false; |
|
|
|
|
|
|
|
// Если нет карты, то не сериализуем. |
|
|
|
// Если нет карты, то не сериализуем. |
|
|
|
if (is_iterable($value)) { |
|
|
|
if (is_iterable($value)) { |
|
|
|
$childMap = is_array($propertyInfo) ? $propertyInfo : null; |
|
|
|
$childMap = is_array($propertyInfo) ? $propertyInfo : null; |
|
|
|
$value = $this->convertArrayByMap($value, $childMap, $tags); |
|
|
|
$value = $this->convertArrayByMap($value, $childMap, $tags); |
|
|
|
} elseif (is_object($value) && is_array($propertyInfo)) { |
|
|
|
} elseif (is_object($value) && is_array($propertyInfo)) { |
|
|
|
$value = $this->convertObjectByMap($value, $propertyInfo, $tags); |
|
|
|
$value = $this->convertObjectByMap($value, $propertyInfo, $tags); |
|
|
|
} elseif (!is_scalar($value) && null !== $value) { |
|
|
|
|
|
|
|
$canSkip = true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this->processIterationTransformers($object, $sourceName, $value, $tags); |
|
|
|
$this->processIterationTransformers($object, $sourceName, $value, $tags); |
|
|
|
|
|
|
|
|
|
|
|
if ($canSkip && !is_scalar($value) && null !== $value) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$dataPath = $this->grabIterationDataPath($object, $sourceName, $tags); |
|
|
|
$dataPath = $this->grabIterationDataPath($object, $sourceName, $tags); |
|
|
|
$data[$dataPath] = $value; |
|
|
|
$data[$dataPath] = $value; |
|
|
|
} catch (\Throwable $e) { |
|
|
|
} catch (\Throwable $e) { |
|
|
|