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

This commit is contained in:
Sipachev Igor 2021-08-17 17:27:53 +07:00
parent 5e470a4497
commit ef336c0d2e

View File

@ -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);