[Serializer] CsvEncoder no header option (encode / decode)#29283
Merged
fabpot merged 1 commit intosymfony:masterfrom Jan 1, 2019
redecs:issue_27447
Merged
[Serializer] CsvEncoder no header option (encode / decode)#29283fabpot merged 1 commit intosymfony:masterfrom redecs:issue_27447
fabpot merged 1 commit intosymfony:masterfrom
redecs:issue_27447
Conversation
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
here are some minor comments.
Member
|
@redecs thank you for submitting PR. Do you plan to fix styling issue from review? I would like to see this feature in a core, please let me know, if I should fix it on your behalf. |
Contributor
Author
|
@diimpp Just pushed the CS fixes. |
nicolas-grekas
approved these changes
Dec 17, 2018
Member
nicolas-grekas
left a comment
There was a problem hiding this comment.
That's a new feature, thus for master.
Member
|
Thank you @redecs. |
fabpot
added a commit
that referenced
this pull request
Jan 1, 2019
…ode) (redecs) This PR was squashed before being merged into the 4.3-dev branch (closes #29283). Discussion ---------- [Serializer] CsvEncoder no header option (encode / decode) | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27447 | License | MIT | Doc PR | - This PR wants to introduce a new context option for the CsvEncoder, `CsvEncoder::NO_HEADERS_KEY` (boolean), that allows CSV encoding/decoding when you don't have/need a header. By default this is assumed to be false, so the headers are included in the CSV output or assumed to be present in the CSV input. When the option is set to true, the following behaviour occurs. Encoding === The following PHP input ```php array(array('a','b'), array('c', 'd')) ``` will generate this CSV output ```csv a,b c,d ``` Decoding === Considering the CSV input to be ```csv a,b c,d ``` the following PHP array will be returned ```php array ( 0 => array ( 0 => 'a', 1 => 'b', ), 1 => array ( 0 => 'c', 1 => 'd', ), ) ``` Commits ------- 0e63c61 [Serializer] CsvEncoder no header option (encode / decode)
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR wants to introduce a new context option for the CsvEncoder,
CsvEncoder::NO_HEADERS_KEY(boolean), that allows CSV encoding/decoding when you don't have/need a header.By default this is assumed to be false, so the headers are included in the CSV output or assumed to be present in the CSV input.
When the option is set to true, the following behaviour occurs.
Encoding
The following PHP input
will generate this CSV output
Decoding
Considering the CSV input to be
the following PHP array will be returned