-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Is your feature request related to a problem? Please describe.
It's both a bug and a feature request to resolve it.
WSDL operations can use same element names with different types. It's a normal practice because operations can use different types. But in WsdlToPhp structs are created by name and elements with name clashes are not handled in any way. If there's an already existing struct, WsdlToPhp thinks it's already been created.
If I have two WSDL operations with same name, one will work incorrectly.
Describe the solution you'd like
A simple way to resolve this would be allowing to prefix structs and enums with an operation name (similar to what could be done for services with gather method).
This could lead to a lot of meaningless duplication, so I think WsdlToPhp could be smarter in dealing with duplication by also checking the type of the element, not just name. Then, if it's a different element with same name, it could prefix or suffix it with the operation name to avoid name clashes.
Describe alternatives you've considered
More correct way would be creating elements in sub-namespaces like so:
VendorName\StructType\CreateObjectRequest
VendorName\StructType\UpdateObjectRequest
VendorName\StructType\CreateObjectRequest\Payload // wraps ObjectDataForCreate
VendorName\StructType\UpdateObjectRequest\Payload // wraps ObjectDataForUpdate
VendorName\StructType\ObjectDataForCreate
VendorName\StructType\ObjectDataForUpdate