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

Appearance settings

[FrameworkBundle] Register the ArrayDenormalizer #20480

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

Closed
wants to merge 2 commits into from

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Nov 10, 2016

Q A
Branch? 3.1
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

Registers the ArrayDenormalizer class in FrameworkBundle.

Why it's a bug fix?

Because since 3.1, most normalizers are able to deserialize complex types (e.g.: an object embedded in an object). They use the Class\Name[] notation to handle collections.

However, this only works when the ArrayDenormalizer has been registered (it is responsible of handling the [] notation).
We do it manually in unit tests, but ArrayDenormalizer has never been integrated in FrameworkBundle.

See the test case for further details.

@jvasseur
Copy link
Contributor

Not sure if this should be treated as a bugfix, people could use some specific array denormalizers, adding the generic one could make their application use it instead of their specific denormalizers leading to bugs.

@dunglas
Copy link
Member Author

dunglas commented Nov 10, 2016

This is very unlikely because:

  • framework's array denormalizer has a low priority
  • the suffix [] is not commonly used in denormalizers

However the bug is real and annoying. Anytime you try to deserialize a document containing an embedded collection, Symfony fails with a an error hard to understand for newcomers (The property "foo" must be of type "Foo\Bar[]", "array" instead).

@xabbuh
Copy link
Member

xabbuh commented Nov 11, 2016

👍 I always registered this one on my own in my applications, but having this done for me in core is much nicer.

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Nov 11, 2016

Thank you @dunglas.

fabpot added a commit that referenced this pull request Nov 11, 2016
This PR was squashed before being merged into the 3.1 branch (closes #20480).

Discussion
----------

[FrameworkBundle] Register the ArrayDenormalizer

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Registers the `ArrayDenormalizer` class in FrameworkBundle.

**Why it's a bug fix?**

Because since 3.1, most normalizers are able to deserialize complex types (e.g.: an object embedded in an object). They use the `Class\Name[]` notation to handle collections.

However, this only works when the `ArrayDenormalizer` has been registered (it is responsible of handling the `[]` notation).
We do it manually in unit tests, but `ArrayDenormalizer` has never been integrated in FrameworkBundle.

See the test case for further details.

Commits
-------

2eedafc [FrameworkBundle] Register the ArrayDenormalizer
@fabpot fabpot closed this Nov 11, 2016
@dunglas dunglas deleted the array_denormalizer branch November 11, 2016 15:51
This was referenced Nov 17, 2016
nicolas-grekas added a commit that referenced this pull request Feb 1, 2017
… case (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] add missing functional Serializer test case

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

This is needed to make the test introduced in #21370. It basically backports the functional test config as introduced by @dunglas in #20480.

Commits
-------

24243ac add missing functional Serializer test case
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.