Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Use NormalizerInterface instead of ObjectNormalizer #18779

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
Oct 10, 2023

Conversation

mtarld
Copy link
Contributor

@mtarld mtarld commented Aug 22, 2023

As mentioned in symfony/maker-bundle#1252 (comment), the documentation is telling to use a concrete implementation of the NormalizerInteface.
This is not the best in terms of OOP, and moreover doesn't work since Symfony 6.1 and the introduction of TraceableNormalizer.

@carsonbot carsonbot added this to the 6.4 milestone Aug 22, 2023
@mtarld mtarld changed the base branch from 6.4 to 6.3 August 22, 2023 07:06

class TopicNormalizer implements NormalizerInterface
{
public function __construct(
private UrlGeneratorInterface $router,
private ObjectNormalizer $normalizer,
private NormalizerInterface $normalizer,
Copy link
Member

Choose a reason for hiding this comment

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

I think this leads to a cyclic dependency, if I remember correctly when I documented something similar 🤔 You may base yourself on those ones I think!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, if forgot about that part, I copied the #18602 PR contents, thanks!
Btw, this is deprecated since 6.1 (and not 6.4), should we update the 6.4 branch as well?

Copy link
Member

Choose a reason for hiding this comment

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

I'd say yes, I guess this may be managed during upmerge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes we will handle it while unmerging this PR 👍

@mtarld mtarld force-pushed the fix/custom-normalizer branch from e4c705b to 07280cd Compare August 22, 2023 12:58
@OskarStark OskarStark changed the title [Serializer] Use NormalizerInterface instead of ObjectNormalizer [Serializer] Use NormalizerInterface instead of ObjectNormalizer Aug 24, 2023
@javiereguiluz
Copy link
Member

@OskarStark if you think this is ready, please merge it. I don't feel confident merging things related to the serializer. Thanks!

@mtarld mtarld force-pushed the fix/custom-normalizer branch from 07280cd to 3e9af1b Compare October 7, 2023 10:17
@OskarStark
Copy link
Contributor

Thank you @mtarld.

@OskarStark OskarStark merged commit eaf4fe4 into symfony:6.3 Oct 10, 2023
@mtarld mtarld deleted the fix/custom-normalizer branch October 10, 2023 14:25
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