Skip to content

Commit 6d74c1a

Browse files
committed
minor #14609 [Serializer] Clarifies 'csv_headers' option (lajosthiel)
This PR was submitted for the 5.2 branch but it was squashed and merged into the 4.4 branch instead. Discussion ---------- [Serializer] Clarifies 'csv_headers' option <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `5.x` for features of unreleased versions). --> Commits ------- e22f015 [Serializer] Clarifies 'csv_headers' option
2 parents 9357aba + e22f015 commit 6d74c1a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/serializer.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,14 @@ Option Description De
842842
``csv_escape_char`` Sets the escape character (at most one character)
843843
``csv_key_separator`` Sets the separator for array's keys during its ``.``
844844
flattening
845-
``csv_headers`` Sets the headers for the data ``[]``, inferred from input data's keys
845+
``csv_headers`` Sets the order of the header and data columns
846+
E.g.: $this->serializer->serialize(
847+
['c' => 3,'a' => 1,'b' => 2],
848+
'csv',
849+
['csv_headers' => ['a', 'b', 'c']]);
850+
returns
851+
a,b,c
852+
1,2,3 ``[]``, inferred from input data's keys
846853
``csv_escape_formulas`` Escapes fields containg formulas by prepending them ``false``
847854
with a ``\t`` character
848855
``as_collection`` Always returns results as a collection, even if only

0 commit comments

Comments
 (0)