Created
November 24, 2011 14:42
-
-
Save armetiz/1391489 to your computer and use it in GitHub Desktop.
Symfony2.XmlEncoder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Encode : array ( array ( "property_name" => ""), array ( "property_name" => "")); | |
<response> | |
<item key="0"><property_name /></item> | |
<item key="1"><property_name /></item> | |
</response> | |
Encode : array ( array ("property_name" => array ( null, null, null ) ), array ("property_name" => array ( null, null, null ) ) ); | |
<response> | |
<item key="0"> | |
<property_name /> | |
<property_name /> | |
<property_name /> | |
</item> | |
<item key="1"> | |
<property_name /> | |
<property_name /> | |
</item> | |
</response> | |
In the XmlEncoder source code, a comment say : "Create nodes to append to $parentNode based on the $key of this array". | |
And, according to my pull-request, the result is more elegant : | |
Encode : array ( array ("property_name" => array ( null, null, null ) ), array ("property_name" => array ( null, null, null ) ) ); | |
<response> | |
<item key="0"> | |
<property_name> | |
<item key="0" /> | |
<item key="1" /> | |
<item key="2" /> | |
</property_name> | |
</item> | |
<item key="1"> | |
<property_name> | |
<item key="0" /> | |
<item key="1" /> | |
</property_name> | |
</item> | |
</response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment