yml_reference.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. YAML Reference
  2. --------------
  3. ::
  4. # Vendor\MyBundle\Resources\config\serializer\Model.ClassName.yml
  5. Vendor\MyBundle\Model\ClassName:
  6. exclusion_policy: ALL
  7. xml_root_name: foobar
  8. xml_root_namespace: http://your.default.namespace
  9. exclude: true
  10. read_only: false
  11. access_type: public_method # defaults to property
  12. accessor_order: custom
  13. custom_accessor_order: [propertyName1, propertyName2, ..., propertyNameN]
  14. discriminator:
  15. field_name: type
  16. map:
  17. some-value: ClassName
  18. virtual_properties:
  19. getSomeProperty:
  20. serialized_name: foo
  21. type: integer
  22. xml_namespaces:
  23. "": http://your.default.namespace
  24. atom: http://www.w3.org/2005/Atom
  25. properties:
  26. some-property:
  27. exclude: true
  28. expose: true
  29. access_type: public_method # defaults to property
  30. accessor: # access_type must be set to public_method
  31. getter: getSomeOtherProperty
  32. setter: setSomeOtherProperty
  33. type: string
  34. serialized_name: foo
  35. since_version: 1.0
  36. until_version: 1.1
  37. groups: [foo, bar]
  38. xml_attribute: true
  39. xml_value: true
  40. inline: true
  41. read_only: true
  42. xml_key_value_pairs: true
  43. xml_list:
  44. inline: true
  45. entry_name: foo
  46. xml_map:
  47. inline: true
  48. key_attribute_name: foo
  49. entry_name: bar
  50. xml_attribute_map: true
  51. xml_element:
  52. cdata: false
  53. namespace: http://www.w3.org/2005/Atom
  54. max_depth: 2
  55. handler_callbacks:
  56. serialization:
  57. xml: serializeToXml
  58. json: serializeToJson
  59. deserialization:
  60. xml: deserializeFromXml
  61. callback_methods:
  62. pre_serialize: [foo, bar]
  63. post_serialize: [foo, bar]
  64. post_deserialize: [foo, bar]