Добавил проверку на пустое значение

master v0.0.10
Sipachev Igor 3 years ago
parent 5e470a4497
commit ef336c0d2e
  1. 3
      src/Data2DtoConverter.php

@ -121,8 +121,7 @@ class Data2DtoConverter
protected function processClass(object $object, ReflectionProperty $property, string $preparedPropertyType, &$value, array $tags) protected function processClass(object $object, ReflectionProperty $property, string $preparedPropertyType, &$value, array $tags)
{ {
if (class_exists($preparedPropertyType)) { if (class_exists($preparedPropertyType)) {
if ($property->isInitialized($object)) { if ($property->isInitialized($object) && $propertyValue = $property->getValue($object)) {
$propertyValue = $property->getValue($object);
$value = $this->convert($value, $propertyValue, $tags); $value = $this->convert($value, $propertyValue, $tags);
} else { } else {
$value = $this->convert($value, new $preparedPropertyType, $tags); $value = $this->convert($value, new $preparedPropertyType, $tags);

Loading…
Cancel
Save