Skip to content

[Serializer] Added scalar denormalization #35235

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
Jan 13, 2020

Conversation

a-menshchikov
Copy link
Contributor

@a-menshchikov a-menshchikov commented Jan 6, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #33784
License MIT

Was added an ability to deserialize scalar data (single or array).

@a-menshchikov a-menshchikov requested a review from dunglas as a code owner January 6, 2020 20:10
@a-menshchikov a-menshchikov changed the title Added scalar denormalization in Serializer [Serializer] Added scalar denormalization Jan 6, 2020
@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Jan 7, 2020
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

a last comment :)

@ogizanagi
Copy link
Contributor

Just asking: does it really make sense for the Serializer and is it consistent to blindly cast the values?
AFAIK, the object normalizer:

@a-menshchikov
Copy link
Contributor Author

@ogizanagi object normalizer doesn't work with scalar values. Data that passed into denormalize method should be an object.

@a-menshchikov a-menshchikov force-pushed the bugfix/33784 branch 2 times, most recently from 1377d5e to 2f3eeb8 Compare January 11, 2020 12:56
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

With a minor cs change

@ogizanagi
Copy link
Contributor

Thx for your patience @a-menshchikov

ogizanagi added a commit that referenced this pull request Jan 13, 2020
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Serializer] Added scalar denormalization

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #33784
| License       | MIT

Was added an ability to deserialize scalar data (single or array).

Commits
-------

dad04d0 Added scalar denormalization in Serializer + added scalar normalization tests
@ogizanagi ogizanagi merged commit dad04d0 into symfony:master Jan 13, 2020
@a-menshchikov a-menshchikov deleted the bugfix/33784 branch January 13, 2020 09:02
@fabpot fabpot mentioned this pull request May 5, 2020
fabpot added a commit that referenced this pull request Dec 8, 2020
…s (vudaltsov)

This PR was squashed before being merged into the 5.1 branch.

Discussion
----------

[Serializer] Fixed serialize and denormalize return types

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | no
| License       | MIT
| Doc PR        | no

Since #35235 `SerializerInterface::deserialize()` and `DenormalizerInterface::denormalize()` return types are no longer correct.

I suggest using `mixed` to allow custom denormalizers to denormalize to any type. For instance, I might add `ClosureDenormalizer` or `NullDenormalizer` or `ResourceDenormalizer`, technically there are no limits.

Commits
-------

67277e5 [Serializer] Fixed serialize and denormalize return types
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.

[Serializer] deserializing array of integers
6 participants