Pārlūkot izejas kodu

Simplified serializing to xml of the nested forms.

Deni 13 gadi atpakaļ
vecāks
revīzija
2f59b06bca

+ 1 - 3
Serializer/Handler/FormErrorHandler.php

@@ -60,10 +60,8 @@ class FormErrorHandler implements SerializationHandlerInterface
                 $visitor->visitArray($data->getErrors(), $type);
                 $visitor->revertCurrentNode();
 
-                // if has nested form, append children node
                 if ($data->hasChildren()) {
-                    $formNode->appendChild($childrenNode = $visitor->document->createElement('children'));
-                    $visitor->setCurrentNode($childrenNode);
+                    $visitor->setCurrentNode($formNode);
 
                     foreach ($data->getChildren() as $child) {
                         $this->serialize($visitor, $child, $type, $visited);

+ 5 - 7
Tests/Serializer/xml/nested_form_errors.xml

@@ -3,11 +3,9 @@
   <errors>
     <entry><![CDATA[This is the form error]]></entry>
   </errors>
-  <children>
-    <form name="bar">
-      <errors>
-        <entry><![CDATA[Error of the child form]]></entry>
-      </errors>
-    </form>
-  </children>
+  <form name="bar">
+    <errors>
+      <entry><![CDATA[Error of the child form]]></entry>
+    </errors>
+  </form>
 </form>