8000 [Serializer] CustomNormalizer Doesn't Support `object_to_populate` · Issue #21715 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] CustomNormalizer Doesn't Support object_to_populate #21715

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
chrisguitarguy opened this issue Feb 22, 2017 · 0 comments
Closed

Comments

@chrisguitarguy
Copy link
Contributor
chrisguitarguy commented Feb 22, 2017
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.2

The CustomNormalizer simply does new $class(); to create the object to denormalize. Would be useful to be able to populate an existing object.

The use case for this is likely the same as other denormalization use cases: sometimes you want to pre-fill fields that are not updated by the serializer. Especially if your custom denormalization process depends on those pre-filled fields.

fabpot added a commit that referenced this issue Sep 27, 2017
…ustomNormalizer (chrisguitarguy)

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

Discussion
----------

[Serializer] Add Support for `object_to_populate` in CustomNormalizer

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

This pulls a trait out of `AbstractNormalizer` with a method to extract the object to populate and adds some tests for it. Then uses that trait in both `AbstractNormalizer` and `CustomNormalizer` so both can support the `object_to_populate` key.

Commits
-------

ec9242d [Serializer] Add Support for  in CustomNormalizer
@fabpot fabpot closed this as completed Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0