[PHP] Bugfix: DateTime object on query (#13583)

* [PHP] BUGFIX: fix code breaking when query params contain a DateTime object

* [PHP] Autogenerated files
This commit is contained in:
Thomas Hansen
2022-10-06 18:45:33 +02:00
committed by GitHub
parent 32936ad71b
commit a37d18a7e4
3 changed files with 19 additions and 0 deletions

View File

@@ -189,6 +189,11 @@ class ObjectSerializer
}
}
# Handle DateTime objects in query
if($openApiType === "\\DateTime" && $value instanceof \DateTime) {
return ["{$paramName}" => $value->format(self::$dateTimeFormat)];
}
$query = [];
$value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value;