Skip to content
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

List of objects #91

Closed
wants to merge 5 commits into from
Closed

Conversation

raziel057
Copy link

This PR needs to be merged at same time than the following:
BeSimple/BeSimpleSoapCommon#2
BeSimple/BeSimpleSoapWsdl#1

The goal of this PR is to fix the problem described here :
BeSimple/BeSimpleSoap#48

With this PR it's possible to define a collection of object like this:

/**
 * @Soap\Alias("ParticipantTypeDetail")
 */
class ParticipantTypeDetail
{
    /**
     * @var string
     * @Soap\ComplexType("string")
     */
    private $name;

    /**
     * @var ParticipantTypeProperty[]
     * @Soap\ComplexType("PTC\WsBundle\TO\ParticipantProperty", minOccurs="1", maxOccurs="unbounded")
     */
    private $participantList;

The related generated WSDL is:

<xsd:complexType name="ParticipantTypeDetail">
    <xsd:all>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="participantList" type="tns:ParticipantProperty" minOccurs="1" maxOccurs="unbounded"/>
    </xsd:all>
</xsd:complexType>

Sample of response from a WS Call:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://organisation.novento-reloaded.eu/ws/MobileApi/1.0/">
   <SOAP-ENV:Body>
      <ns1:getParticipantTypeDetailsResponse>
         <return>
            <name>Supplier</name>
            <participantList>
               <id>12</id>
               <firstName>Thomas</firstName>
               <lastName>Lallement</lastName>
               <organisation>Decostanding</organisation>
               <position>Driver</position>
               <participationStatusClass>accredited</participationStatusClass>
            </participantList>
            <participantList>
               <id>22</id>
               <firstName>Jerome</firstName>
               <lastName>Martin</lastName>
               <organisation>Decostanding</organisation>
               <position>Fire departement</position>
               <participationStatusClass>requested</participationStatusClass>
            </participantList>
         </return>
      </ns1:getParticipantTypeDetailsResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

So from the client side we can fetch the results by doing (sample with PHP Classmap)

$participantList = $myObject->getParticipantList();

Rather than (current behavior):

$participantList = $myObject->getParticipantList()->item;

@raziel057
Copy link
Author

Closed because the PR is linked to other ones that need to be mergerd on [READ-ONLY] Subtree split of the BeSimpleSoap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant