Skip to content

Making default PHP namespace generic and fix issues 628 and 635 #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public String getHelp() {
public PhpClientCodegen() {
super();

//TODO determine hte package name from host name
invokerPackage = camelize("SwaggerPetstore");
invokerPackage = camelize("SwaggerClient");

String packagePath = invokerPackage + "-php";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
$original_property_name = $instance::$attributeMap[$property];
if (isset($original_property_name)) {
$instance->$property = self::deserialize($data->$original_property_name, $type);
}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/swagger-codegen/src/main/resources/php/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down