Skip to content

Commit 8cc6fea

Browse files
authored
Adds example for csv_headers
1 parent a36944a commit 8cc6fea

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
@@ -897,7 +897,14 @@ Option Description De
897897
``csv_escape_char`` Sets the escape character (at most one character)
898898
``csv_key_separator`` Sets the separator for array's keys during its ``.``
899899
flattening
900-
``csv_headers`` Sets the order of the header and data columns ``[]``, inferred from input data's keys
900+
``csv_headers`` Sets the order of the header and data columns
901+
E.g.: $this->serializer->serialize(
902+
['c' => 3,'a' => 1,'b' => 2],
903+
CsvEncoder::FORMAT,
904+
[CsvEncoder::HEADERS_KEY => ['a', 'b', 'c']]);
905+
returns
906+
a,b,c
907+
1,2,3 ``[]``, inferred from input data's keys
901908
``csv_escape_formulas`` Escapes fields containg formulas by prepending them ``false``
902909
with a ``\t`` character
903910
``as_collection`` Always returns results as a collection, even if only

0 commit comments

Comments
 (0)