I have some troubles getting the xml output I expect using jms serializer and symfony 3.
I have an entity called "reference". Using the annotation @XmlRoot("reference") and returning one object only, the xml output of fos rest bundle is as expected:
<reference>
<id>1</id>
<title>Title 1</title>
</reference>
But if I output an array of the same objects (returned by doctrines findAll()
method) I get this:
<result>
<entry>
<id>1</id>
<title>Title 1</title>
</entry>
<entry>
<id>2</id>
<title>Title 2</title>
</entry>
<entry>
<id>3/id>
<title>Title 3</title>
</entry>
</result>
The tag is called <entry>
but I'd like to achieve this:
<result>
<reference>
<id>1</id>
<title>Title 1</title>
</reference>
<reference>
<id>2</id>
<title>Title 2</title>
</reference>
<reference>
<id>3/id>
<title>Title 3</title>
</reference>
</result>
(I don't know how to use @XmlList
in this case, because I do not have a parent entity holding the reference items...)
Thank you!