Skip to content

Commit e04e582

Browse files
committed
fix mapping varname in case of variable case changing.
1 parent 4379a23 commit e04e582

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

modules/openapi-generator/src/main/resources/php/model_generic.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par
261261
*/
262262
private function setIfExists(string $variableName, array $fields, $defaultValue): void
263263
{
264-
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
265-
$this->openAPINullablesSetToNull[] = $variableName;
264+
$apivar = $this->attributeMap()[$variableName];
265+
if (self::isNullable($variableName) && array_key_exists($apivar, $fields) && is_null($fields[$apivar])) {
266+
$this->openAPINullablesSetToNull[] = $apivar;
266267
}
267-
268-
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
268+
$this->container[$variableName] = $fields[$apivar] ?? $defaultValue;
269269
}
270270

271271
/**

0 commit comments

Comments
 (0)