forked from loafle/openapi-generator-original
[php-symfony] Support for default scalar value of properties in model (#16605)
* Add support for default scalar value of properties in php-symfony models. Default values now returns in getter-functions * Revert nullable type-hinting. Move default values from getter to property initialize. Made changes in __construct: Now value of properties rewrites only if key exist in $data array.
This commit is contained in:
@@ -74,9 +74,11 @@ class ApiResponse
|
||||
*/
|
||||
public function __construct(array $data = null)
|
||||
{
|
||||
$this->code = $data['code'] ?? null;
|
||||
$this->type = $data['type'] ?? null;
|
||||
$this->message = $data['message'] ?? null;
|
||||
if (is_array($data)) {
|
||||
$this->code = array_key_exists('code', $data) ? $data['code'] : $this->code;
|
||||
$this->type = array_key_exists('type', $data) ? $data['type'] : $this->type;
|
||||
$this->message = array_key_exists('message', $data) ? $data['message'] : $this->message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user