Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Serializer] CsvEncoder: allow the nested array parsing to be disabled#49692

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Deuchnord wants to merge4 commits intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromDeuchnord:feat/serializer/csvencoder-separator-key-false

Conversation

Deuchnord
Copy link

@DeuchnordDeuchnord commentedMar 15, 2023
edited by OskarStark
Loading

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
TicketsN/A
LicenseMIT
Doc PRsymfony/symfony-docs#18127

By default,CsvEncoder decoding process explodes the headers automatically based on the. character to generate nested arrays, the separation character being configurable based on our needs. For instance:

username,birth.day,birth.month,birth.yeardeuchnord,9,6,1993

Would result in the following PHP array:

["username" =>"deuchnord","birth" => ["day" =>9,"month => 6,"year" =>1993    ]]

This is a very nice feature, but in some cases, we prefer to skip the generation of those nested arrays.
This PR provides a way to disable it by simply setting the already existentCsvEncoder::KEY_SEPARATOR_KEY option tofalse, so the same CSV above now results to:

["username" =>"deuchnord","birth.day" =>9,"birth.month => 6,"birth.year" =>1993]

alexislefebvre, Nek-, and andreybolonin reacted with thumbs up emoji
@dunglas
Copy link
Member

I'm 👍 for the feature, but what about encoding? You should updateCsvEncoder::flatten() to take the new allowed value into account.

@dunglas
Copy link
Member

Also, usingfalse as a magic value will remove the ability to choose the character to use as a separator. What about introducing a newcsv_flatten option instead?

OskarStark reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
@OskarStark
Copy link
Contributor

@Deuchnord open to finish this PR? I would really appreciate this new feature!

Please rebase on 7.1 branch, thanks

@Deuchnord
Copy link
Author

I'm sorry, I didn't have much time lastly
I will try to finish it as soon as I can

OskarStark reacted with heart emoji

@xabbuhxabbuh modified the milestones:7.1,7.2May 15, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mtarldmtarldmtarld requested changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

8 participants
@Deuchnord@dunglas@OskarStark@mtarld@fabpot@nicolas-grekas@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp