Skip to content

Commit 0fcd27c

Browse files
committed
feature #20128 [Serializer] Deprecate passing a non-empty CSV escape char (alexandre-daubois)
This PR was merged into the 7.2 branch. Discussion ---------- [Serializer] Deprecate passing a non-empty CSV escape char Fix #20126 Commits ------- 3567f5b [Serializer] Deprecate passing a non-empty CSV escape char
2 parents 0581165 + 3567f5b commit 0fcd27c

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

components/serializer.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,30 +1064,35 @@ which defines the configuration options for the CsvEncoder an associative array:
10641064

10651065
These are the options available:
10661066

1067-
======================= ===================================================== ==========================
1068-
Option Description Default
1069-
======================= ===================================================== ==========================
1070-
``csv_delimiter`` Sets the field delimiter separating values (one ``,``
1067+
======================= ============================================================= ==========================
1068+
Option Description Default
1069+
======================= ============================================================= ==========================
1070+
``csv_delimiter`` Sets the field delimiter separating values (one ``,``
10711071
character only)
1072-
``csv_enclosure`` Sets the field enclosure (one character only) ``"``
1073-
``csv_end_of_line`` Sets the character(s) used to mark the end of each ``\n``
1072+
``csv_enclosure`` Sets the field enclosure (one character only) ``"``
1073+
``csv_end_of_line`` Sets the character(s) used to mark the end of each ``\n``
10741074
line in the CSV file
1075-
``csv_escape_char`` Sets the escape character (at most one character) empty string
1076-
``csv_key_separator`` Sets the separator for array's keys during its ``.``
1075+
``csv_escape_char`` Deprecated. Sets the escape character (at most one character) empty string
1076+
``csv_key_separator`` Sets the separator for array's keys during its ``.``
10771077
flattening
10781078
``csv_headers`` Sets the order of the header and data columns
10791079
E.g.: if ``$data = ['c' => 3, 'a' => 1, 'b' => 2]``
10801080
and ``$options = ['csv_headers' => ['a', 'b', 'c']]``
10811081
then ``serialize($data, 'csv', $options)`` returns
1082-
``a,b,c\n1,2,3`` ``[]``, inferred from input data's keys
1083-
``csv_escape_formulas`` Escapes fields containing formulas by prepending them ``false``
1082+
``a,b,c\n1,2,3`` ``[]``, inferred from input data's keys
1083+
``csv_escape_formulas`` Escapes fields containing formulas by prepending them ``false``
10841084
with a ``\t`` character
1085-
``as_collection`` Always returns results as a collection, even if only ``true``
1085+
``as_collection`` Always returns results as a collection, even if only ``true``
10861086
one line is decoded.
1087-
``no_headers`` Setting to ``false`` will use first row as headers. ``false``
1087+
``no_headers`` Setting to ``false`` will use first row as headers. ``false``
10881088
``true`` generate numeric headers.
1089-
``output_utf8_bom`` Outputs special `UTF-8 BOM`_ along with encoded data ``false``
1090-
======================= ===================================================== ==========================
1089+
``output_utf8_bom`` Outputs special `UTF-8 BOM`_ along with encoded data ``false``
1090+
======================= ============================================================= ==========================
1091+
1092+
.. deprecated:: 7.2
1093+
1094+
The ``csv_escape_char`` option and the ``CsvEncoder::ESCAPE_CHAR_KEY``
1095+
constant were deprecated in Symfony 7.2.
10911096

10921097
The ``XmlEncoder``
10931098
~~~~~~~~~~~~~~~~~~
@@ -1304,6 +1309,11 @@ you can use "context builders" to define the context using a fluent interface::
13041309
You can also :doc:`create custom context builders </serializer/custom_context_builders>`
13051310
to deal with your context values.
13061311

1312+
.. deprecated:: 7.2
1313+
1314+
The ``CsvEncoderContextBuilder::withEscapeChar()`` method was deprecated
1315+
in Symfony 7.2.
1316+
13071317
Skipping ``null`` Values
13081318
------------------------
13091319

0 commit comments

Comments
 (0)