我已经使用Symfony 2.6withFOSRestBundle和实现了 Web 服务JMSSerializerBundle。
request即使我放入xml_root_name: request了配置文件,我也无法命名一个根元素。
我有一个config\serializer\Entity.Request.yml包含以下信息的文件:
Tvjp\RequestBundle\Entity\Request:
exclusion_policy: ALL
xml_root_name: request
properties:
id:
expose: true
type: integer
label:
expose: true
type: string
issuer:
expose: true
type: string
当我尝试访问单个request时,这就是我在 XML 中得到的:
<result>
<id>23</id>
<label><![CDATA[ test label ws post ]]></label>
<issuer><![CDATA[ test issuer ws post ]]></issuer>
</result>
我在 json 中得到了什么:{"id":23,"label":"test label ws post","issuer":"test issuer ws post"}
任何想法我在这里做错了什么?