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] documentation for allow_extra_attributes#6975

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

Conversation

@juliendidier
Copy link
Contributor

@juliendidierjuliendidierforce-pushed theserializer-extra-attributes branch fromf4400f3 toe6818fcCompareSeptember 18, 2016 10:49
@weaverryanweaverryan changed the title[Serializer] documentation for allow_extra_attributes[WCM][Serializer] documentation for allow_extra_attributesSep 19, 2016
has a fourth parameter, the context. If you want to throw an exception if an attribute is outside
the object scope, use ``allow_extra_attributes`` as ``false``.

This will throws a:class:`Symfony\\Component\\Serializer\\Exception\\ExtraAttributesException` exception,
Copy link
Member

Choose a reason for hiding this comment

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

This will throw an [...]

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done

the object scope, use ``allow_extra_attributes`` as ``false``.

This will throws a:class:`Symfony\\Component\\Serializer\\Exception\\ExtraAttributesException` exception,
because city is not an attribute of ``Acme\Person``::
Copy link
Member

Choose a reason for hiding this comment

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

[...] because city is not an attribute of thePerson class

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done

by the serializer.
:method:`Symfony\\Component\\Serializer\\Serializer::deserialize`
has a fourth parameter, the context. If you want to throw an exception if an attribute is outside
the object scope, use ``allow_extra_attributes`` as ``false``.
Copy link
Member

Choose a reason for hiding this comment

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

I would reword this a bit:

By default, additional attributes that are not mapped to the denormalized object will be ignored by the Serializer component. Set theallow_extra_attributes key of the deserialization context tofalse to let the serializer throw an exception when additional attributes are passed.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

done

@juliendidier
Copy link
ContributorAuthor

@xabbuh thanks for your review

@xabbuhxabbuh added this to the3.3 milestoneNov 12, 2016
symfony-splitter pushed a commit to symfony/serializer that referenced this pull requestDec 5, 2016
… used during an object denor… (juliendidier)This PR was merged into the 3.3-dev branch.Discussion----------[Serializer] Throw exception when extra attributes are used during an object denor…| Q | A || --- | --- || Branch? | "master" || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | no || Tests pass? | yes || Fixed tickets | #19948 || License | MIT || Doc PR | [#6975](symfony/symfony-docs#6975) |I will update the doc if you're ok with this PR.Commits-------565a984 throw exception when extra attributes are used during an object denormalization
dunglas added a commit to symfony/symfony that referenced this pull requestDec 5, 2016
… used during an object denor… (juliendidier)This PR was merged into the 3.3-dev branch.Discussion----------[Serializer] Throw exception when extra attributes are used during an object denor…| Q | A || --- | --- || Branch? | "master" || Bug fix? | no || New feature? | yes || BC breaks? | no || Deprecations? | no || Tests pass? | yes || Fixed tickets |#19948 || License | MIT || Doc PR | [#6975](symfony/symfony-docs#6975) |I will update the doc if you're ok with this PR.Commits-------565a984 throw exception when extra attributes are used during an object denormalization
@xabbuhxabbuh removed the On hold labelDec 6, 2016
@xabbuh
Copy link
Member

The code PR has been merged.

@wouterj
Copy link
Member

👍
status: reviewed

(there is a minor issue with the line length and the second paragraph can maybe replaced by a code comment in de code itself, but those things can be fixed during the merge)

@javiereguiluzjaviereguiluz changed the title[WCM][Serializer] documentation for allow_extra_attributes[Serializer] documentation for allow_extra_attributesDec 23, 2016
@xabbuhxabbuh changed the base branch frommaster to3.2March 3, 2017 07:46
@xabbuhxabbuh changed the base branch from3.2 tomasterMarch 3, 2017 07:47
@xabbuh
Copy link
Member

Thank you@juliendidier.

@xabbuhxabbuh merged commit28dcc94 intosymfony:masterMar 3, 2017
xabbuh added a commit that referenced this pull requestMar 3, 2017
…juliendidier)This PR was merged into the master branch.Discussion----------[Serializer] documentation for allow_extra_attributesDoc PR for [symfony/symfony#19958](symfony/symfony#19958)Commits-------28dcc94 [Serializer] documentation for allow_extra_attributes
xabbuh added a commit that referenced this pull requestMar 3, 2017
@juliendidierjuliendidier deleted the serializer-extra-attributes branchMarch 7, 2017 09:26
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh left review comments

+1 more reviewer

@dunglasdunglasdunglas approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

6 participants

@juliendidier@xabbuh@wouterj@dunglas@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp