-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
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. |
This is very unlikely because:
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 ( |
1a67e2b
to
8c5b756
Compare
👍 I always registered this one on my own in my applications, but having this done for me in core is much nicer. Status: Reviewed |
Thank you @dunglas. |
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
… 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
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.