xml_reference.rst 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. XML Reference
  2. -------------
  3. ::
  4. <!-- MyBundle\Resources\config\serializer\ClassName.xml -->
  5. <?xml version="1.0" encoding="UTF-8" ?>
  6. <serializer>
  7. <class name="Fully\Qualified\ClassName" exclusion-policy="ALL" xml-root-name="foo-bar" exclude="true"
  8. accessor-order="custom" custom-accessor-order="propertyName1,propertyName2,...,propertyNameN"
  9. access-type="public_method">
  10. <property name="some-property"
  11. exclude="true"
  12. expose="true"
  13. type="string"
  14. serialized-name="foo"
  15. since-version="1.0"
  16. until-version="1.1"
  17. xml-attribute="true"
  18. access-type="public_method"
  19. accessor-getter="getSomeProperty"
  20. accessor-setter="setSomeProperty"
  21. inline="true"
  22. read-only="true"
  23. groups="foo,bar"
  24. xml-key-value-pairs="true"
  25. xml-attribute-map="true"
  26. >
  27. <!-- You can also specify the type as element which is necessary if
  28. your type contains "<" or ">" characters. -->
  29. <type><![CDATA[]]></type>
  30. <xml-list inline="true" entry-name="foobar" />
  31. <xml-map inline="true" key-attribute-name="foo" entry-name="bar" />
  32. </property>
  33. <callback-method name="foo" type="pre-serialize" />
  34. <callback-method name="bar" type="post-serialize" />
  35. <callback-method name="baz" type="post-deserialize" />
  36. <callback-method name="serializeToXml" type="handler" direction="serialization" format="xml" />
  37. <callback-method name="deserializeFromJson" type="handler" direction="deserialization" format="xml" />
  38. </class>
  39. </serializer>