Conversation
|
Did you check @XmlKeyValuePairs? After a quick look, it looks like what you are proposing. |
|
Just checked it, it doesnt produce the expected XML. I'm using this class: <?php
/**
* @Serializer\XmlRoot("input")
*/
class Input
{
/**
* @Serializer\XmlAttributeMap
*/
public $attributes = array(
'type' => 'integer',
'value' => '1',
'name' => 'search[page]',
);
}With <input>
<attributes>
<type>
<![CDATA[integer]]>
</type>
<value>
<![CDATA[1]]>
</value>
<name>
<![CDATA[search[page]]]>
</name>
</attributes>
</input>Whereas with <input type="integer" value="1" name="search[page]"/> |
|
@schmittjoh ? Is there something missing in my implementation, tests ? |
|
Looks good, could you rebase this on latest master? It should only require a minor update in the base test case. |
|
Rebase on master done |
There was a problem hiding this comment.
Did you add the Traversable check here?
There was a problem hiding this comment.
Huh ? !$v instanceof \Traversable
There was a problem hiding this comment.
Just asking because I've removed the special handling for traversables in the master branch. However, in that case we can probably keep it.
Could you add an extra test case to avoid regressions?
There was a problem hiding this comment.
I'm going to remove the Traversable handling, because YamlSerializationVisitor::75 uses array_keys. On a Traversable object it fails.
|
@schmittjoh I removed the Traversable handling, and added a test in |
|
Thanks, merged! |
Hi,
I needed this, so I share it.
I'm not sure if the results i'm expecting for the json and yaml formats are right.
In the tests i expect:
But should it be
Any feedback is welcome.