Bladeren bron

Provide support for nillable types in a WSDL file.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22560 44c647ce-9c0f-0410-b52a-842ac1e357ba
rquadling 15 jaren geleden
bovenliggende
commit
ef277d6581
1 gewijzigde bestanden met toevoegingen van 9 en 1 verwijderingen
  1. 9 1
      library/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php

+ 9 - 1
library/Zend/Soap/Wsdl/Strategy/DefaultComplexType.php

@@ -55,6 +55,8 @@ class Zend_Soap_Wsdl_Strategy_DefaultComplexType extends Zend_Soap_Wsdl_Strategy
         $dom = $this->getContext()->toDomDocument();
         $class = new ReflectionClass($type);
 
+        $defaultProperties = $class->getDefaultProperties();
+
         $complexType = $dom->createElement('xsd:complexType');
         $complexType->setAttribute('name', $type);
 
@@ -68,8 +70,14 @@ class Zend_Soap_Wsdl_Strategy_DefaultComplexType extends Zend_Soap_Wsdl_Strategy
                  * node for describing other classes used as attribute types for current class
                  */
                 $element = $dom->createElement('xsd:element');
-                $element->setAttribute('name', $property->getName());
+                $element->setAttribute('name', $propertyName = $property->getName());
                 $element->setAttribute('type', $this->getContext()->getType(trim($matches[1][0])));
+
+                // If the default value is null, then this property is nillable.
+                if (is_null($defaultProperties[$propertyName])) {
+                    $element->setAttribute('nillable', 'true');
+                }
+
                 $all->appendChild($element);
             }
         }