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

subdirectory not converted in namespaces #256

Closed lmartin59 closed 2 years ago

lmartin59 commented 3 years ago

when a Folder option contains a sub directory with "/" the namespace is not converted to "\" exemple :

$options = GeneratorOptions::instance();
            $options 
...
 ->setNamespace("App\TestWS")
                ->setStructsFolder("Domain/Entities")
                ->setServicesFolder("Infrastructure/".$service);

The generator create the file in the right place in App/TestWS/Domain/Entities but the namespace of structs class is :

namespace App\TestWS\Domain/Entities;

and

?\App\TestWS\Domain/Entities\CommuneDTO

I took the liberty of testing a modification in the class AbstractModel line 258

$namespaces[] = str_replace('/','\\',$this->getSubDirectory());

and it work

mikaelcom commented 3 years ago

Thanks for your feedback. Which version are you using?

lmartin59 commented 3 years ago

it's wsdltophp/packagegenerator version 4.0.2 with PHP 7.4 on debian docker image

voipminic commented 3 years ago

I have the same problem using CLI in Debian with php7.4

voipminic commented 3 years ago

solved putting the namespace beteween '' ( --namespace='vendor\app\subdir' )

mikaelcom commented 3 years ago

I'll fix it very soon, thx for your feedback!

mikaelcom commented 3 years ago

This bug is also present in the 3.* versions, to be fixed :)

mikaelcom commented 3 years ago

Can you try with either:

Thx