Closed rauanmayemir closed 3 years ago
This option is used in the getExtends method depending if the struct is actually an Array Struct or not.
The StructArrayTest contains the tests about the usage of the option (but I must admit without another class that the default one) but the GeneratorOptionsTest ensures the option is well set.
Does StructArray
handle cases like:
<Products>
<Product>...</Product>
<Product>...</Product>
</Products>
where Products
would extend BaseStructArray
, or it's for some other use cases?
It depends on several conditions visible in the isArray method that depends from the XSD declaration.
Can you paste it?
Here's an XSD example:
<xs:element name="products">
<xs:complexType>
<xs:sequence>
<xs:element name="product" type="tns:Product" minOccurs="1" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="Product">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="description" type="xs:string" minOccurs="0">
</xs:element>
<xs:element name="quantity" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="6"/>
<xs:totalDigits value="18"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
Products
struct will have a static validateProductForArrayConstraintsFromSetProduct
method, but I wish there was also a better way to understand that struct consumes an array.
It may depend from the element/complexType that uses the products element.
I'm not sure to understand what's bothering/blocking you... If you can send me the complete WSDL and what you expect, I'll possibly get a better picture of your need.
There's no WSDL, cause I'm doing this out of XSD only.
What was bothering me is that I was traversing XML manually and trying to hydrate the struct. I couldn't know if the struct accepted arrays, but I solved it by checking if there was an addToProperty
method (that would mean 'property' is array). I stopped pursuing this direction due to other issues.
SOAP and its beauty :sweat_smile:
I've set
->setStructArrayClass(BaseStructArray::class)
option inGeneratorOptions
, but I don't see any of my structs to be extended from it (when it's clearly a sort of array wrapper thing).How can I make a repro case for it? I couldn't find any unit tests for
struct_array
.