modify the properties from container array

This commit is contained in:
abcsun
2016-05-07 15:55:38 +08:00
parent 0695708594
commit df1d36cf47
8 changed files with 67 additions and 67 deletions

View File

@@ -164,36 +164,36 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
{
$invalid_properties = array();
{{#vars}}{{#required}}
if ($this->{{name}} === null) {
if ($this->container['{{name}}'] === null) {
$invalid_properties[] = "'${{name}}' can't be null";
}{{/required}}
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array($this->{{name}}, $allowed_values))) {
if (!in_array($this->container['{{name}}'], $allowed_values))) {
$invalid_properties[] = "invalid value for '${{name}}', must be one of #{allowed_values}.";
}{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->{{name}}) > {{maxLength}}) {
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
$invalid_properties[] = "invalid value for '${{name}}', the character length must be smaller than or equal to {{{maxLength}}}.";
}
{{/maxLength}}
{{#minLength}}
if (strlen($this->{{name}}) < {{minLength}}) {
if (strlen($this->container['{{name}}']) < {{minLength}}) {
$invalid_properties[] = "invalid value for '${{name}}', the character length must be bigger than or equal to {{{minLength}}}.";
}
{{/minLength}}
{{#maximum}}
if ($this->{{name}} > {{maximum}}) {
if ($this->container['{{name}}'] > {{maximum}}) {
$invalid_properties[] = "invalid value for '${{name}}', must be smaller than or equal to {{maximum}}.";
}
{{/maximum}}
{{#minimum}}
if ($this->{{name}} < {{minimum}}) {
if ($this->container['{{name}}'] < {{minimum}}) {
$invalid_properties[] = "invalid value for '${{name}}', must be bigger than or equal to {{minimum}}.";
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", $this->{{name}})) {
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) {
$invalid_properties[] = "invalid value for '${{name}}', must be conform to the pattern {{pattern}}.";
}
{{/pattern}}{{/hasValidation}}{{/vars}}
@@ -209,36 +209,36 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}imple
public function valid()
{
{{#vars}}{{#required}}
if ($this->{{name}} === null) {
if ($this->container['{{name}}'] === null) {
return false;
}{{/required}}
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
if (!in_array($this->{{name}}, $allowed_values))) {
if (!in_array($this->container['{{name}}'], $allowed_values))) {
return false;
}{{/isEnum}}
{{#hasValidation}}
{{#maxLength}}
if (strlen($this->{{name}}) > {{maxLength}}) {
if (strlen($this->container['{{name}}']) > {{maxLength}}) {
return false;
}
{{/maxLength}}
{{#minLength}}
if (strlen($this->{{name}}) < {{minLength}}) {
if (strlen($this->container['{{name}}']) < {{minLength}}) {
return false;
}
{{/minLength}}
{{#maximum}}
if ($this->{{name}} > {{maximum}}) {
if ($this->container['{{name}}'] > {{maximum}}) {
return false;
}
{{/maximum}}
{{#minimum}}
if ($this->{{name}} < {{minimum}}) {
if ($this->container['{{name}}'] < {{minimum}}) {
return false;
}
{{/minimum}}
{{#pattern}}
if (!preg_match("{{pattern}}", $this->{{name}})) {
if (!preg_match("{{pattern}}", $this->container['{{name}}'])) {
return false;
}
{{/pattern}}{{/hasValidation}}{{/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-05-07T07:39:11.271Z
- Build date: 2016-05-07T07:50:05.452Z
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
## Requirements

View File

@@ -143,7 +143,7 @@ class Animal implements ArrayAccess
{
$invalid_properties = array();
if ($this->class_name === null) {
if ($this->container['class_name'] === null) {
$invalid_properties[] = "'$class_name' can't be null";
}
@@ -160,7 +160,7 @@ class Animal implements ArrayAccess
public function valid()
{
if ($this->class_name === null) {
if ($this->container['class_name'] === null) {
return false;
}

View File

@@ -206,17 +206,17 @@ class EnumTest implements ArrayAccess
$invalid_properties = array();
$allowed_values = array("UPPER", "lower");
if (!in_array($this->enum_string, $allowed_values))) {
if (!in_array($this->container['enum_string'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$enum_string', must be one of #{allowed_values}.";
}
$allowed_values = array("1", "-1");
if (!in_array($this->enum_integer, $allowed_values))) {
if (!in_array($this->container['enum_integer'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$enum_integer', must be one of #{allowed_values}.";
}
$allowed_values = array("1.1", "-1.2");
if (!in_array($this->enum_number, $allowed_values))) {
if (!in_array($this->container['enum_number'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$enum_number', must be one of #{allowed_values}.";
}
@@ -233,17 +233,17 @@ class EnumTest implements ArrayAccess
{
$allowed_values = array("UPPER", "lower");
if (!in_array($this->enum_string, $allowed_values))) {
if (!in_array($this->container['enum_string'], $allowed_values))) {
return false;
}
$allowed_values = array("1", "-1");
if (!in_array($this->enum_integer, $allowed_values))) {
if (!in_array($this->container['enum_integer'], $allowed_values))) {
return false;
}
$allowed_values = array("1.1", "-1.2");
if (!in_array($this->enum_number, $allowed_values))) {
if (!in_array($this->container['enum_number'], $allowed_values))) {
return false;
}

View File

@@ -297,63 +297,63 @@ class FormatTest implements ArrayAccess
$invalid_properties = array();
if ($this->integer > 100.0) {
if ($this->container['integer'] > 100.0) {
$invalid_properties[] = "invalid value for '$integer', must be smaller than or equal to 100.0.";
}
if ($this->integer < 10.0) {
if ($this->container['integer'] < 10.0) {
$invalid_properties[] = "invalid value for '$integer', must be bigger than or equal to 10.0.";
}
if ($this->int32 > 200.0) {
if ($this->container['int32'] > 200.0) {
$invalid_properties[] = "invalid value for '$int32', must be smaller than or equal to 200.0.";
}
if ($this->int32 < 20.0) {
if ($this->container['int32'] < 20.0) {
$invalid_properties[] = "invalid value for '$int32', must be bigger than or equal to 20.0.";
}
if ($this->number === null) {
if ($this->container['number'] === null) {
$invalid_properties[] = "'$number' can't be null";
}
if ($this->number > 543.2) {
if ($this->container['number'] > 543.2) {
$invalid_properties[] = "invalid value for '$number', must be smaller than or equal to 543.2.";
}
if ($this->number < 32.1) {
if ($this->container['number'] < 32.1) {
$invalid_properties[] = "invalid value for '$number', must be bigger than or equal to 32.1.";
}
if ($this->float > 987.6) {
if ($this->container['float'] > 987.6) {
$invalid_properties[] = "invalid value for '$float', must be smaller than or equal to 987.6.";
}
if ($this->float < 54.3) {
if ($this->container['float'] < 54.3) {
$invalid_properties[] = "invalid value for '$float', must be bigger than or equal to 54.3.";
}
if ($this->double > 123.4) {
if ($this->container['double'] > 123.4) {
$invalid_properties[] = "invalid value for '$double', must be smaller than or equal to 123.4.";
}
if ($this->double < 67.8) {
if ($this->container['double'] < 67.8) {
$invalid_properties[] = "invalid value for '$double', must be bigger than or equal to 67.8.";
}
if (!preg_match("/[a-z]/i", $this->string)) {
if (!preg_match("/[a-z]/i", $this->container['string'])) {
$invalid_properties[] = "invalid value for '$string', must be conform to the pattern /[a-z]/i.";
}
if ($this->byte === null) {
if ($this->container['byte'] === null) {
$invalid_properties[] = "'$byte' can't be null";
}
if ($this->date === null) {
if ($this->container['date'] === null) {
$invalid_properties[] = "'$date' can't be null";
}
@@ -362,14 +362,14 @@ class FormatTest implements ArrayAccess
if ($this->password === null) {
if ($this->container['password'] === null) {
$invalid_properties[] = "'$password' can't be null";
}
if (strlen($this->password) > 64) {
if (strlen($this->container['password']) > 64) {
$invalid_properties[] = "invalid value for '$password', the character length must be smaller than or equal to 64.";
}
if (strlen($this->password) < 10) {
if (strlen($this->container['password']) < 10) {
$invalid_properties[] = "invalid value for '$password', the character length must be bigger than or equal to 10.";
}
@@ -386,63 +386,63 @@ class FormatTest implements ArrayAccess
{
if ($this->integer > 100.0) {
if ($this->container['integer'] > 100.0) {
return false;
}
if ($this->integer < 10.0) {
if ($this->container['integer'] < 10.0) {
return false;
}
if ($this->int32 > 200.0) {
if ($this->container['int32'] > 200.0) {
return false;
}
if ($this->int32 < 20.0) {
if ($this->container['int32'] < 20.0) {
return false;
}
if ($this->number === null) {
if ($this->container['number'] === null) {
return false;
}
if ($this->number > 543.2) {
if ($this->container['number'] > 543.2) {
return false;
}
if ($this->number < 32.1) {
if ($this->container['number'] < 32.1) {
return false;
}
if ($this->float > 987.6) {
if ($this->container['float'] > 987.6) {
return false;
}
if ($this->float < 54.3) {
if ($this->container['float'] < 54.3) {
return false;
}
if ($this->double > 123.4) {
if ($this->container['double'] > 123.4) {
return false;
}
if ($this->double < 67.8) {
if ($this->container['double'] < 67.8) {
return false;
}
if (!preg_match("/[a-z]/i", $this->string)) {
if (!preg_match("/[a-z]/i", $this->container['string'])) {
return false;
}
if ($this->byte === null) {
if ($this->container['byte'] === null) {
return false;
}
if ($this->date === null) {
if ($this->container['date'] === null) {
return false;
}
@@ -451,14 +451,14 @@ class FormatTest implements ArrayAccess
if ($this->password === null) {
if ($this->container['password'] === null) {
return false;
}
if (strlen($this->password) > 64) {
if (strlen($this->container['password']) > 64) {
return false;
}
if (strlen($this->password) < 10) {
if (strlen($this->container['password']) < 10) {
return false;
}

View File

@@ -166,7 +166,7 @@ class Name implements ArrayAccess
{
$invalid_properties = array();
if ($this->name === null) {
if ($this->container['name'] === null) {
$invalid_properties[] = "'$name' can't be null";
}
@@ -187,7 +187,7 @@ class Name implements ArrayAccess
public function valid()
{
if ($this->name === null) {
if ($this->container['name'] === null) {
return false;
}

View File

@@ -229,7 +229,7 @@ class Order implements ArrayAccess
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->status, $allowed_values))) {
if (!in_array($this->container['status'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
}
@@ -256,7 +256,7 @@ class Order implements ArrayAccess
$allowed_values = array("placed", "approved", "delivered");
if (!in_array($this->status, $allowed_values))) {
if (!in_array($this->container['status'], $allowed_values))) {
return false;
}

View File

@@ -224,12 +224,12 @@ class Pet implements ArrayAccess
if ($this->name === null) {
if ($this->container['name'] === null) {
$invalid_properties[] = "'$name' can't be null";
}
if ($this->photo_urls === null) {
if ($this->container['photo_urls'] === null) {
$invalid_properties[] = "'$photo_urls' can't be null";
}
@@ -237,7 +237,7 @@ class Pet implements ArrayAccess
$allowed_values = array("available", "pending", "sold");
if (!in_array($this->status, $allowed_values))) {
if (!in_array($this->container['status'], $allowed_values))) {
$invalid_properties[] = "invalid value for '$status', must be one of #{allowed_values}.";
}
@@ -257,12 +257,12 @@ class Pet implements ArrayAccess
if ($this->name === null) {
if ($this->container['name'] === null) {
return false;
}
if ($this->photo_urls === null) {
if ($this->container['photo_urls'] === null) {
return false;
}
@@ -270,7 +270,7 @@ class Pet implements ArrayAccess
$allowed_values = array("available", "pending", "sold");
if (!in_array($this->status, $allowed_values))) {
if (!in_array($this->container['status'], $allowed_values))) {
return false;
}