forked from loafle/openapi-generator-original
add attributemap to php model, update php petstore sample
This commit is contained in:
parent
c109c11bea
commit
ab8d62214a
@ -182,7 +182,7 @@ class APIClient {
|
|||||||
} else if (is_object($data)) {
|
} else if (is_object($data)) {
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||||
$values[$property] = $this->sanitizeForSerialization($data->$property);
|
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||||
}
|
}
|
||||||
$sanitized = $values;
|
$sanitized = $values;
|
||||||
} else {
|
} else {
|
||||||
@ -295,7 +295,8 @@ class APIClient {
|
|||||||
$instance = new $class();
|
$instance = new $class();
|
||||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||||
if (isset($data->$property)) {
|
if (isset($data->$property)) {
|
||||||
$instance->$property = self::deserialize($data->$property, $type);
|
$original_property_name = $instance::$attributeMap[$property];
|
||||||
|
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$deserialized = $instance;
|
$deserialized = $instance;
|
||||||
|
@ -30,6 +30,11 @@ class {{classname}} implements ArrayAccess {
|
|||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
{{#vars}}{{#description}}
|
{{#vars}}{{#description}}
|
||||||
/**
|
/**
|
||||||
* {{{description}}}
|
* {{{description}}}
|
||||||
|
@ -182,7 +182,7 @@ class APIClient {
|
|||||||
} else if (is_object($data)) {
|
} else if (is_object($data)) {
|
||||||
$values = array();
|
$values = array();
|
||||||
foreach (array_keys($data::$swaggerTypes) as $property) {
|
foreach (array_keys($data::$swaggerTypes) as $property) {
|
||||||
$values[$property] = $this->sanitizeForSerialization($data->$property);
|
$values[$data::$attributeMap[$property]] = $this->sanitizeForSerialization($data->$property);
|
||||||
}
|
}
|
||||||
$sanitized = $values;
|
$sanitized = $values;
|
||||||
} else {
|
} else {
|
||||||
@ -295,7 +295,8 @@ class APIClient {
|
|||||||
$instance = new $class();
|
$instance = new $class();
|
||||||
foreach ($instance::$swaggerTypes as $property => $type) {
|
foreach ($instance::$swaggerTypes as $property => $type) {
|
||||||
if (isset($data->$property)) {
|
if (isset($data->$property)) {
|
||||||
$instance->$property = self::deserialize($data->$property, $type);
|
$original_property_name = $instance::$attributeMap[$property];
|
||||||
|
$instance->$property = self::deserialize($data->$original_property_name, $type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$deserialized = $instance;
|
$deserialized = $instance;
|
||||||
|
@ -28,6 +28,11 @@ class Category implements ArrayAccess {
|
|||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
'id' => 'id',
|
||||||
|
'name' => 'name'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public $id; /* int */
|
public $id; /* int */
|
||||||
public $name; /* string */
|
public $name; /* string */
|
||||||
|
@ -32,6 +32,15 @@ class Order implements ArrayAccess {
|
|||||||
'complete' => 'boolean'
|
'complete' => 'boolean'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
'id' => 'id',
|
||||||
|
'petId' => 'petId',
|
||||||
|
'quantity' => 'quantity',
|
||||||
|
'shipDate' => 'shipDate',
|
||||||
|
'status' => 'status',
|
||||||
|
'complete' => 'complete'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public $id; /* int */
|
public $id; /* int */
|
||||||
public $petId; /* int */
|
public $petId; /* int */
|
||||||
|
@ -32,6 +32,15 @@ class Pet implements ArrayAccess {
|
|||||||
'status' => 'string'
|
'status' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
'id' => 'id',
|
||||||
|
'category' => 'category',
|
||||||
|
'name' => 'name',
|
||||||
|
'photoUrls' => 'photoUrls',
|
||||||
|
'tags' => 'tags',
|
||||||
|
'status' => 'status'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public $id; /* int */
|
public $id; /* int */
|
||||||
public $category; /* Category */
|
public $category; /* Category */
|
||||||
|
@ -28,6 +28,11 @@ class Tag implements ArrayAccess {
|
|||||||
'name' => 'string'
|
'name' => 'string'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
'id' => 'id',
|
||||||
|
'name' => 'name'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public $id; /* int */
|
public $id; /* int */
|
||||||
public $name; /* string */
|
public $name; /* string */
|
||||||
|
@ -34,6 +34,17 @@ class User implements ArrayAccess {
|
|||||||
'userStatus' => 'int'
|
'userStatus' => 'int'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
static $attributeMap = array(
|
||||||
|
'id' => 'id',
|
||||||
|
'username' => 'username',
|
||||||
|
'firstName' => 'firstName',
|
||||||
|
'lastName' => 'lastName',
|
||||||
|
'email' => 'email',
|
||||||
|
'password' => 'password',
|
||||||
|
'phone' => 'phone',
|
||||||
|
'userStatus' => 'userStatus'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public $id; /* int */
|
public $id; /* int */
|
||||||
public $username; /* string */
|
public $username; /* string */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user