-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Allow to pass csv encoder options in context #22537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fabpot
merged 1 commit into
symfony:master
from
ogizanagi:feature/serializer/csv_encoder_context_options
Apr 29, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking: is there any reason to name these constants
*_KEY
instead of*_CHAR
? I was checking the popular CSV library published by ThePhpLeague and they say that the separator, enclosure, etc. can only be 1 char: https://github.com/thephpleague/csv/blob/master/src/AbstractCsv.php#L42There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the
KEY
suffix is not about csv at all. It's about the constant representing the key of the option to pass in the context argument. See DateTimeNormalizer::FORMAT_KEY for reference. 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my confusion!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps your confusion is legit and the naming should be more explicit though. I named it after
DateTimeNormalizer::FORMAT_KEY
, but that's currently the only occurence of such a suffixed constant in the serializer component. Other constants for options like in the AbstractNormalizer are simply named after the option itself, without any suffix.Also in a different topic, some options like
allow_extra_attributes
,attributes
, orkey_type
don't even have any constant. Maybe it's worth adding them and always ask for constants for new options in the future?ping @dunglas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely agree.