Merge pull request #630 from who/develop_2.0

Making default PHP namespace generic and fix issues 628 and 635
This commit is contained in:
Tony Tam 2015-04-14 12:35:44 -07:00
commit dfa17d2291
3 changed files with 7 additions and 8 deletions

View File

@ -28,8 +28,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
public PhpClientCodegen() { public PhpClientCodegen() {
super(); super();
//TODO determine hte package name from host name invokerPackage = camelize("SwaggerClient");
invokerPackage = camelize("SwaggerPetstore");
String packagePath = invokerPackage + "-php"; String packagePath = invokerPackage + "-php";

View File

@ -289,8 +289,8 @@ class APIClient {
$class = "{{invokerPackage}}\\models\\".$class; $class = "{{invokerPackage}}\\models\\".$class;
$instance = new $class(); $instance = new $class();
foreach ($instance::$swaggerTypes as $property => $type) { foreach ($instance::$swaggerTypes as $property => $type) {
if (isset($data->$property)) { $original_property_name = $instance::$attributeMap[$property];
$original_property_name = $instance::$attributeMap[$property]; if (isset($original_property_name)) {
$instance->$property = self::deserialize($data->$original_property_name, $type); $instance->$property = self::deserialize($data->$original_property_name, $type);
} }
} }

View File

@ -73,14 +73,14 @@ class {{classname}} {
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->toFormValue(${{paramName}}); $formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->toFormValue(${{paramName}});
}{{/formParams}} }{{/formParams}}
{{#bodyParams}}// body params {{#bodyParams}}// body params
$body = null; $_tempBody = null;
if (isset(${{paramName}})) { if (isset(${{paramName}})) {
$body = ${{paramName}}; $_tempBody = ${{paramName}};
}{{/bodyParams}} }{{/bodyParams}}
// for model (json/xml) // for model (json/xml)
if (isset($body)) { if (isset($_tempBody)) {
$httpBody = $body; // $body is the method argument, if present $httpBody = $_tempBody; // $_tempBody is the method argument, if present
} }
// for HTTP post (form) // for HTTP post (form)