WsdlToPhp/PackageGenerator

Different destination dir when generating using 3.2.7 VS 4.1.1 ??

mikaelcom opened this issue · 2 comments

Discussed in #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!

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,

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 :-)