yml_reference.rst 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. disabled: false
  17. map:
  18. some-value: ClassName
  19. groups: [foo, bar]
  20. xml_attribute: true
  21. xml_element:
  22. cdata: false
  23. namespace: http://www.w3.org/2005/Atom
  24. virtual_properties:
  25. getSomeProperty:
  26. serialized_name: foo
  27. type: integer
  28. expression_prop:
  29. exp: object.getName()
  30. serialized_name: foo
  31. type: integer
  32. xml_namespaces:
  33. "": http://your.default.namespace
  34. atom: http://www.w3.org/2005/Atom
  35. properties:
  36. some-property:
  37. exclude: true
  38. expose: true
  39. exclude_if: expr
  40. expose_if: expr
  41. skip_when_empty: false
  42. access_type: public_method # defaults to property
  43. accessor: # access_type must be set to public_method
  44. getter: getSomeOtherProperty
  45. setter: setSomeOtherProperty
  46. type: string
  47. serialized_name: foo
  48. since_version: 1.0
  49. until_version: 1.1
  50. groups: [foo, bar]
  51. xml_attribute: true
  52. xml_value: true
  53. inline: true
  54. read_only: true
  55. xml_key_value_pairs: true
  56. xml_list:
  57. inline: true
  58. entry_name: foo
  59. namespace: http://www.w3.org/2005/Atom
  60. xml_map:
  61. inline: true
  62. key_attribute_name: foo
  63. entry_name: bar
  64. namespace: http://www.w3.org/2005/Atom
  65. xml_attribute_map: true
  66. xml_element:
  67. cdata: false
  68. namespace: http://www.w3.org/2005/Atom
  69. max_depth: 2
  70. handler_callbacks:
  71. serialization:
  72. xml: serializeToXml
  73. json: serializeToJson
  74. deserialization:
  75. xml: deserializeFromXml
  76. callback_methods:
  77. pre_serialize: [foo, bar]
  78. post_serialize: [foo, bar]
  79. post_deserialize: [foo, bar]