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() {
super();
//TODO determine hte package name from host name
invokerPackage = camelize("SwaggerPetstore");
invokerPackage = camelize("SwaggerClient");
String packagePath = invokerPackage + "-php";

View File

@ -289,8 +289,8 @@ class APIClient {
$class = "{{invokerPackage}}\\models\\".$class;
$instance = new $class();
foreach ($instance::$swaggerTypes as $property => $type) {
if (isset($data->$property)) {
$original_property_name = $instance::$attributeMap[$property];
if (isset($original_property_name)) {
$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}}
{{#bodyParams}}// body params
$body = null;
$_tempBody = null;
if (isset(${{paramName}})) {
$body = ${{paramName}};
$_tempBody = ${{paramName}};
}{{/bodyParams}}
// for model (json/xml)
if (isset($body)) {
$httpBody = $body; // $body is the method argument, if present
if (isset($_tempBody)) {
$httpBody = $_tempBody; // $_tempBody is the method argument, if present
}
// for HTTP post (form)