-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Serializer] Fix AbstractObjectNormalizer to allow scalar values to be normalized
#58473
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
This comment was marked as outdated.
This comment was marked as outdated.
|
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "7.2 for features / 5.4, 6.4, and 7.1 for bug fixes". Cheers! Carsonbot |
|
It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you. Cheers! Carsonbot |
|
"Allow edits from maintainer" doesn't work because that is a Group Repository |
ScalarNormalizer to allow custom values for boolean
ScalarNormalizer to allow custom values for booleanScalarNormalizer to allow custom values for boolean
|
Your fix is very specific. Why ScalarNormalizer allows only booleans? You probably should create BooleanNormalizer instead. And it also mast supports denormalization, so you have to add appropriate methods and fix demormalization method in AbstractObjectNormalizer |
|
@andreybotanic because this is only the start, for #58429 I wanted to add something to format numeric/float/int too, Yeah, denormalization might need to be done too. My use-case was for normalizing into stuff that can be denormalized too. (like "true/false" for boolean.) I will try to update the denormalize way soon. (for example, "yes/no" for boolean) |
|
@nicolas-grekas similar to #59501 can you look into this MR? I need to find a way to normalize boolean into "true" and "false" instead of "1" and "0" |
src/Symfony/Component/Serializer/Normalizer/ScalarNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Show resolved
Hide resolved
7eafeab to
d2a8a77
Compare
d2a8a77 to
cafac2c
Compare
|
hm, I need to think about the test cases. For example: |
ScalarNormalizer to allow custom values for booleanAbstractObjectNormalizer to allow scalar values to be normalized
src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php
Outdated
Show resolved
Hide resolved
af7cff6 to
5bd2a42
Compare
|
Finally, the tests are green again 😂 |
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Normalizer/ObjectNormalizerTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
Show resolved
Hide resolved
558259a to
80f1df4
Compare
|
Thank you @Hanmac. |
…r values to be normalized (Hanmac, xabbuh) This PR was merged into the 6.4 branch. Discussion ---------- [Serializer] Fix `AbstractObjectNormalizer` to allow scalar values to be normalized | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #58056 | License | MIT It still does work when the Normalizer is used with Serializer (like it normally would?), Commits ------- e195833 ObjectNormalizer: allow null and scalar
|
Merged as c5a661a |
It still does work when the Normalizer is used with Serializer (like it normally would?),