mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +00:00
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:
commit
dfa17d2291
@ -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";
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user