-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefix local types with parent type-name #41
Conversation
2d84d9f
to
8e37325
Compare
8e37325
to
5ea8ffe
Compare
Hello @veewee, from my testing, when I have the restriction for an Here is the WSDL I'm testing on (currently, only the types are important):
|
…that the encoder doesnt get confused
@MudrakIvan Can you try again with these new changes? |
@veewee I've tested it, and everything seems to work (even the complex type with any element). Would it be possible to prepend the name of the parent type for complex types as well (via some config, of course)? It could resolve some problems with different types with the same names in the same namespaces (but with other parents). |
Can you provide an example of what you are trying to achieve? |
Sure. It's really similar to the local enums. XSD for the example:
I want to determine which |
Okay, I see ... It might indeed make sense to just prefix those by-default as well. |
I've looked into it deeper and won't do that for now: This would make the generated code not compatible with PHP's ext-soap's classmap:
$sc = new \Soap\ExtSoapEngine\AbusedClient('foo.wsdl', [
'classmap' => [
'Customer' => Customer::class,
'address' => Address::class,
'Company' => Company::class
]
]); Which means that if I apply this type-change, people on soap-client 2 and 3 will get classes that are not encodeable / decodable with PHP's soap driver. It's a breaking change I can't really afford at the moment. Maybe in a few years, when people have migrated to the latest soap-client which uses the customly written encoder component it will be possible to sunset and introduce this behaviour. It's something I could benifit from as well in the service I'm working with. But it won't be for now. |
@veewee I undrestand the BC concern. However, do you think it could be triggered by configuration (if it could be easily added) or via some custom |
A It's not something that is easily added. If you want to make this configurable, the best place is to add some additional configuration to I'm currently not going to implement it myself. But I surely don't mind helping out if you care to craft a PR for that yourself. |
Summary
Introduced for phpro/soap-client#561
The newly introduced
ParentContext
can also be used as a starting point to fix issues like phpro/soap-client#540The PR changes the way the name of an attribute type is calculated:
This PR also changes the way element type names are calculated:
In order to detect the parents, a newly
ParentContext
is introduced.