forked from loafle/openapi-generator-original
* [PHP] Add support to nullable (based on PR 3493) * [AUTOGENERATED] update samples
This commit is contained in:
@@ -98,7 +98,7 @@ class ObjectSerializer
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($value !== null) {
|
||||
if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) {
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]);
|
||||
}
|
||||
}
|
||||
@@ -469,7 +469,15 @@ class ObjectSerializer
|
||||
foreach ($instance::openAPITypes() as $property => $type) {
|
||||
$propertySetter = $instance::setters()[$property];
|
||||
|
||||
if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) {
|
||||
if (!isset($propertySetter)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($data->{$instance::attributeMap()[$property]})) {
|
||||
if ($instance::isNullable($property)) {
|
||||
$instance->$propertySetter(null);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user