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] Add support for serializing empty array as object#42297

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

Merged
fabpot merged 1 commit intosymfony:5.4fromlyrixx:serializer-empty
Jul 30, 2021

Conversation

@lyrixx
Copy link
Member

@lyrixxlyrixx commentedJul 27, 2021
edited
Loading

QA
Branch?5.4
Bug fix?yes (fix a new feature)
New feature?yes (fix a new feature)
Deprecations?no
TicketsFix#42282
LicenseMIT
Doc PRsymfony/symfony-docs#15554

New usage:

publicfunction__construct(        #[Context([Serializer::EMPTY_ARRAY_AS_OBJECT =>true ])]publicarray$mapWithOption = [],        #[Context([Serializer::EMPTY_ARRAY_AS_OBJECT =>true ])]publicarray$mapWithOptionAndData = ['foo' =>'bar'],publicarray$mapWithoutOption = [],publicarray$mapWithoutOptionAndData = ['foo' =>'bar'],    ) {    }

=>

{"mapWithOption":{},"mapWithOptionAndData":{"foo":"bar"},"mapWithoutOption":[],"mapWithoutOptionAndData":{"foo":"bar"}}

@derrabusderrabus added this to the5.4 milestoneJul 29, 2021
@lyrixxlyrixxforce-pushed theserializer-empty branch 4 times, most recently frome6e2719 to00e8270CompareJuly 29, 2021 16:16
@lyrixxlyrixx changed the title[Serializer] Add support for serializing empty collection as object[Serializer] Add support for serializing empty array as objectJul 29, 2021
Copy link
Contributor

@FoxprodevFoxprodev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Great! Looks reasonable and correct for me now. Thanks for the time!

lyrixx reacted with heart emoji
@derrabus
Copy link
Member

Please make fabbot happy.

@fabpot
Copy link
Member

Thank you@lyrixx.

@fabpotfabpot merged commit62d4f44 intosymfony:5.4Jul 30, 2021
@lyrixxlyrixx deleted the serializer-empty branchJuly 30, 2021 10:37
This was referencedNov 5, 2021
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestAug 8, 2022
…ect in example (alanpoulain)This PR was merged into the 5.4 branch.Discussion----------[Serializer] fix(serializer): missing empty_array_as_object in exampleThis PR:- Replaces `empty_iterable_as_object` by `preserve_empty_objects`, like it should be.- Adds `empty_array_as_object` to example in Serializer Context.- Removes the mention `by default`, since it's `false` by default.Related:-#15554-#15580-symfony/symfony#42240-symfony/symfony#42297Commits-------cc54517 fix(serializer): missing empty_array_as_object in example
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@chalasrchalasrchalasr approved these changes

@dunglasdunglasAwaiting requested review from dunglasdunglas is a code owner

+1 more reviewer

@FoxprodevFoxprodevFoxprodev approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.4

Development

Successfully merging this pull request may close these issues.

[Serializer] preserving empty object breaks current array lists

6 participants

@lyrixx@derrabus@fabpot@chalasr@Foxprodev@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp