xml_reference.rst 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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" discriminator-field-name="type">
  10. <discriminator-class value="some-value">ClassName</discriminator-class>
  11. <property name="some-property"
  12. exclude="true"
  13. expose="true"
  14. type="string"
  15. serialized-name="foo"
  16. since-version="1.0"
  17. until-version="1.1"
  18. xml-attribute="true"
  19. access-type="public_method"
  20. accessor-getter="getSomeProperty"
  21. accessor-setter="setSomeProperty"
  22. inline="true"
  23. read-only="true"
  24. groups="foo,bar"
  25. xml-key-value-pairs="true"
  26. xml-attribute-map="true"
  27. max-depth="2"
  28. >
  29. <!-- You can also specify the type as element which is necessary if
  30. your type contains "<" or ">" characters. -->
  31. <type><![CDATA[]]></type>
  32. <xml-list inline="true" entry-name="foobar" />
  33. <xml-map inline="true" key-attribute-name="foo" entry-name="bar" />
  34. </property>
  35. <callback-method name="foo" type="pre-serialize" />
  36. <callback-method name="bar" type="post-serialize" />
  37. <callback-method name="baz" type="post-deserialize" />
  38. <callback-method name="serializeToXml" type="handler" direction="serialization" format="xml" />
  39. <callback-method name="deserializeFromJson" type="handler" direction="deserialization" format="xml" />
  40. </class>
  41. </serializer>