fix getter for allowableValues for php enum

This commit is contained in:
wing328 2016-04-02 19:18:49 +08:00
parent 800a858acb
commit 2c9e9ee425
15 changed files with 323 additions and 287 deletions

View File

@ -109,18 +109,18 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = "{{{value}}}";
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
{{#isEnum}}
{{#vars}}{{#isEnum}}
/**
* Gets allowable values of the enum
* @return string[]
*/
public function {{getter}}AllowableValues() {
return [
{{#allowableValues}}{{#values}}self::{{datatypeWithEnum}}_{{{this}}},{{^-last}}
{{/-last}}{{/values}}{{/allowableValues}}
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
{{/-last}}{{/enumVars}}{{/allowableValues}}
];
}
{{/isEnum}}
{{/isEnum}}{{/vars}}
{{#vars}}
/**

View File

@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-04-02T19:03:06.710+08:00
- Build date: 2016-04-02T19:17:12.338+08:00
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements

View File

@ -120,6 +120,18 @@ class InlineResponse200 implements ArrayAccess
/**
* Gets allowable values of the enum
* @return string[]
*/
public function getStatusAllowableValues() {
return [
self::STATUS_AVAILABLE,
self::STATUS_PENDING,
self::STATUS_SOLD,
];
}
/**

View File

@ -120,6 +120,18 @@ class Order implements ArrayAccess
/**
* Gets allowable values of the enum
* @return string[]
*/
public function getStatusAllowableValues() {
return [
self::STATUS_PLACED,
self::STATUS_APPROVED,
self::STATUS_DELIVERED,
];
}
/**

View File

@ -120,6 +120,18 @@ class Pet implements ArrayAccess
/**
* Gets allowable values of the enum
* @return string[]
*/
public function getStatusAllowableValues() {
return [
self::STATUS_AVAILABLE,
self::STATUS_PENDING,
self::STATUS_SOLD,
];
}
/**