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

Fix issue with "item" for collection of objects #2

Merged
merged 12 commits into from
Sep 12, 2016
Merged

Fix issue with "item" for collection of objects #2

merged 12 commits into from
Sep 12, 2016

Conversation

raziel057
Copy link
Collaborator

The goal of this PR is to fix the problem described here :
BeSimple#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 raziel057 merged commit f6f617c into cybermo:master Sep 12, 2016
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