WsdlToPhp / PackageGenerator

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

Different destination dir when generating using 3.2.7 VS 4.1.1 ?? #262

Closed mikaelcom closed 2 years ago

mikaelcom commented 2 years ago

Discussed in https://github.com/WsdlToPhp/PackageGenerator/discussions/261

Originally posted by **mwolff-fn** February 3, 2022 Hi, I was using the PackageGenerator via wsdltophp.phar in version 3.2.7 before and now I joyfully discovered that I can now install the latest version via Phar, so I did that, upgrading to 4.1.1. Now, when I run the generator using the exact same settings as before, the directory structures of the generated files will be completely different. Suppose I run this command with wsdltophp.phar 3.2.7 (additionally, the "standalone" option is set to false in wsdltophp.yml): `wsdltophp generate:package --urlorpath="./resources/SERVICE.wsdl" --destination="./proxy/soap/$SERVICE" --namespace="My\\Namespace\\Proxy\\Soap\\SERVICE" --force --verbose` ...then I will get the following directory structure: ``` /project_root /proxy /soap /SERVICE /Enum ...enum class files... /Service Service.php /Struct ...struct class files... ClassMap.php tutorial.php ``` ...and all class files will be generated with the namespace prefix "My\Namespace\Proxy\Soap\SERVICE", followed by the category name (e.g. "\Service", "\Enum", "\Struct"). If I wanted to generate proxy classes for multiple services, I just need to point Composer's autoloader to /proxy/soap for all namespaces beginning with My\Namespace\Proxy\Soap and I'm done. Now, if I re-generate the proxy classes using the exact same configuration with the wsdltophp.phar version 4.1.1, then I'm getting this directory structure instead: ``` /project_root /proxy /soap /SERVICE /My /Namespace /Proxy /Soap /SERVICE /Enum ...enum class files... /Service Service.php /Struct ...struct class files... ClassMap.php ``` So basically, the generator now uses the initial destination dir as a base and appends the whole namespace as subdirectory structure, which is neither desired nor the previous behaviour. How can I fix that and regenerate the classes in the same directory structure as before, while keeping the same namespace settings?? Thanks a lot!
mikaelcom commented 2 years ago

Hi,

I just added the comand line option namespace-directories of type bool which is true by default. In your case, you would have to pass false to keep the original behaviour you had.

Can you try the phar from https://phar.wsdltophp/wsdltophp-feature-issue-262-php7.phar or the Docker image using mikaelcom/wsdltophp:feature-issue-262?

Let me know when you had the time to check,

mwolff-fn commented 2 years ago

I just added the comand line option namespace-directories of type bool which is true by default. In your case, you would have to pass false to keep the original behaviour you had.

Can you try the phar from https://phar.wsdltophp.com/wsdltophp-feature-issue-262-php7.phar or the Docker image using mikaelcom/wsdltophp:feature-issue-262?

Works like a charm - thank you so much for the quick fix :-)