WsdlToPhp / PackageGenerator

Generates a PHP SDK based on a WSDL, simple and powerful, WSDL to PHP
https://providr.io
MIT License
426 stars 73 forks source link

Wrong varialbe name in StructType #183

Closed BorislavSabev closed 5 years ago

BorislavSabev commented 5 years ago

I've been using this generation for a long time with no issues however I've just encountered one.

I've seen a case where a variable name inside a setter for a StructType is different that the param in the function.

public function setLogin($login = null)
{
    // validation for constraint: string
    if (!is_null($login_1) && !is_string($login_1)) {
        throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($login_1)), __LINE__);
    }
    $this->login = $login_1;
    return $this;
}   

Notice that the variable inside is $login_1 whereas the param is $login

I did chekc the WSDL and there is nothing to indicate the existance of $login_1 there WSDL is located here

mikaelcom commented 5 years ago

Probably due to the fact that the property is named as its class (except for the first uppercase letter):

<s:element name="Login">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="login" type="s:string"/>
   <s:element minOccurs="0" maxOccurs="1" name="sha1Password" type="s:string"/>
  </s:sequence>
 </s:complexType>
</s:element>

I must admit that the PHP generation is something that must be reviewed but I'll fix this issue soon before refactoring the PHP generation

mikaelcom commented 5 years ago

@BorislavSabev If you're able to use the feature/issue-183 branch source code, you should not have this issue anymore. Let me know, Thx

BorislavSabev commented 5 years ago

@mikaelcom I'll test it when I have the time.

Thank you very much

BorislavSabev commented 5 years ago

@mikaelcom I can confirm that is working with the branch feature/issue-183