@@ -878,6 +878,34 @@ The ``CsvEncoder``
878
878
879
879
The ``CsvEncoder `` encodes to and decodes from CSV.
880
880
881
+ The ``CsvEncoder `` Context Options
882
+ ..................................
883
+
884
+ The ``encode() `` method defines a third optional parameter called ``context ``
885
+ which defines the configuration options for the CsvEncoder an associative array::
886
+
887
+ $csvEncoder->encode($array, 'csv', $context);
888
+
889
+ These are the options available:
890
+
891
+ ======================= ==================================================== ==========================
892
+ Option Description Default
893
+ ======================= ==================================================== ==========================
894
+ ``csv_delimiter `` Sets the field delimiter separating values (one ``, ``
895
+ character only)
896
+ ``csv_enclosure `` Sets the field enclosure (one character only) ``" ``
897
+ ``csv_escape_char `` Sets the escape character (at most one character)
898
+ ``csv_key_separator `` Sets the separator for array's keys during its ``. ``
899
+ flattening
900
+ ``csv_headers `` Sets the headers for the data ``[] ``, inferred from input data's keys
901
+ ``csv_escape_formulas `` Escapes fields containg formulas by prepending them ``false ``
902
+ with a ``\t `` character
903
+ ``as_collection `` Always returns results as a collection, even if only
904
+ one line is decoded.
905
+ ``no_headers `` Disables header in the encoded CSV ``false ``
906
+ ``output_utf8_bom `` Outputs special `UTF-8 BOM `_ along with encoded data ``false ``
907
+ ======================= ==================================================== ==========================
908
+
881
909
The ``XmlEncoder ``
882
910
~~~~~~~~~~~~~~~~~~
883
911
@@ -945,23 +973,18 @@ which defines the configuration options for the XmlEncoder an associative array:
945
973
946
974
These are the options available:
947
975
948
- ``xml_format_output ``
949
- If set to true, formats the generated XML with line breaks and indentation.
950
-
951
- ``xml_version ``
952
- Sets the XML version attribute (default: ``1.1 ``).
953
-
954
- ``xml_encoding ``
955
- Sets the XML encoding attribute (default: ``utf-8 ``).
956
-
957
- ``xml_standalone ``
958
- Adds standalone attribute in the generated XML (default: ``true ``).
959
-
960
- ``xml_root_node_name ``
961
- Sets the root node name (default: ``response ``).
962
-
963
- ``remove_empty_tags ``
964
- If set to true, removes all empty tags in the generated XML (default: ``false ``).
976
+ ====================== ==================================================== ==========================
977
+ Option Description Default
978
+ ====================== ==================================================== ==========================
979
+ ``xml_format_output `` If set to true, formats the generated XML with line
980
+ breaks and indentation.
981
+ ``xml_version `` Sets the XML version attribute ``1.1 ``
982
+ ``xml_encoding `` Sets the XML encoding attribute ``utf-8 ``
983
+ ``xml_standalone `` Adds standalone attribute in the generated XML ``true ``
984
+ ``xml_root_node_name `` Sets the root node name (default: ``response ``).
985
+ ``remove_empty_tags `` If set to true, removes all empty tags in the ``false ``
986
+ generated XML
987
+ ====================== ==================================================== ==========================
965
988
966
989
The ``YamlEncoder ``
967
990
~~~~~~~~~~~~~~~~~~~
@@ -1274,49 +1297,6 @@ you indicate that you're expecting an array instead of a single object::
1274
1297
$data = ...; // The serialized data from the previous example
1275
1298
$persons = $serializer->deserialize($data, 'Acme\Person[]', 'json');
1276
1299
1277
-
1278
- The ``CsvEncoder ``
1279
- ------------------
1280
-
1281
- This encoder transforms arrays into CSV and vice versa.
1282
-
1283
- Context
1284
- ~~~~~~~
1285
-
1286
- The ``encode() `` method defines a third optional parameter called ``context ``
1287
- which defines the configuration options for the CsvEncoder an associative array::
1288
-
1289
- $csvEncoder->encode($array, 'csv', $context);
1290
-
1291
- These are the options available:
1292
-
1293
- ``csv_delimiter ``
1294
- Sets the field delimiter separating values (one character only, default: ``, ``).
1295
-
1296
- ``csv_enclosure ``
1297
- Sets the field enclosure (one character only, default: ``" ``).
1298
-
1299
- ``csv_escape_char ``
1300
- Sets the escape character (at most one character, default: empty string).
1301
-
1302
- ``csv_key_separator ``
1303
- Sets the separator for array's keys during its flattening (default: ``. ``).
1304
-
1305
- ``csv_headers ``
1306
- Sets the headers for the data (default: ``[] ``, inferred from input data's keys).
1307
-
1308
- ``csv_escape_formulas ``
1309
- Escapes fields containg formulas by prepending them with a ``\t `` character (default: ``false ``).
1310
-
1311
- ``as_collection ``
1312
- Always returns results as a collection, even if only one line is decoded.
1313
-
1314
- ``no_headers ``
1315
- Disables header in the encoded CSV (default: ``false ``).
1316
-
1317
- ``output_utf8_bom ``
1318
- Outputs special `UTF-8 BOM `_ along with encoded data (default: ``false ``).
1319
-
1320
1300
Handling Constructor Arguments
1321
1301
------------------------------
1322
1302
0 commit comments