Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix extra attributes when no group specified #24816

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
merged 1 commit into from
Nov 5, 2017
Merged

[Serializer] Fix extra attributes when no group specified #24816

merged 1 commit into from
Nov 5, 2017

Conversation

ogizanagi
Copy link
Contributor

@ogizanagi ogizanagi commented Nov 4, 2017

Q A
Branch? 3.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #24783
License MIT
Doc PR N/A

Two commits, for two possible solutions, but I think the last one is probably the most efficient one, as the first one will also impact normalization and systematically try to intersect allowedAttributes and extractedAttributes.

@@ -175,6 +175,13 @@ public function denormalize($data, $class, $format = null, array $context = arra
}

$allowedAttributes = $this->getAllowedAttributes($class, $context, true);

if (false === $allowedAttributes && $this->classMetadataFactory) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably useless to do this if $context[self::ALLOW_EXTRA_ATTRIBUTES] is not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. Thanks :)

@ogizanagi ogizanagi added this to the 3.3 milestone Nov 4, 2017
@fabpot
Copy link
Member

fabpot commented Nov 5, 2017

Thank you @ogizanagi.

@fabpot fabpot merged commit d1b343c into symfony:3.3 Nov 5, 2017
fabpot added a commit that referenced this pull request Nov 5, 2017
…(ogizanagi)

This PR was merged into the 3.3 branch.

Discussion
----------

[Serializer] Fix extra attributes when no group specified

| Q             | A
| ------------- | ---
| Branch?       | 3.3 <!-- see comment below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24783 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

~~Two commits, for two possible solutions, but I think the last one is probably the most efficient one, as the first one will also impact normalization and systematically try to intersect allowedAttributes and extractedAttributes.~~

Commits
-------

d1b343c [Serializer] Fix extra attributes when no group specified
@ogizanagi ogizanagi deleted the fix/serializer_extra_attributes_no_groups branch November 5, 2017 15:53
nicolas-grekas added a commit that referenced this pull request Mar 16, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] Remove const override

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

This public const was moved to parent class in #24816

Commits
-------

25312c4 [Serializer] Remove const override
ogizanagi added a commit that referenced this pull request Jun 21, 2018
…mented (deviantintegral)

This PR was squashed before being merged into the 3.4 branch (closes #26534).

Discussion
----------

allow_extra_attributes does not throw an exception as documented

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none
| License       | MIT
| Doc PR        | none

The example at [Deserializing an object](https://symfony.com/doc/current/components/serializer.html#deserializing-an-object) does not actually work. It looks like this is a bug and not a docs issue. #24783 reported the same bug, but it looks like the fix at #24816 isn't complete.

Here's a failing test that copies the existing example.

Commits
-------

a67b650 allow_extra_attributes does not throw an exception as documented
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants