-
-
Notifications
You must be signed in to change notification settings - Fork 929
fix(serializer): deprecate SerializerAwareProviderInterface and SerializableProvider #7348
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
base: 4.2
Are you sure you want to change the base?
fix(serializer): deprecate SerializerAwareProviderInterface and SerializableProvider #7348
Conversation
@vinceAmstoutz the deprecation reason seems a bit generic to me, could you elaborate it please? Could be in the PR description for history purpose 🙂 Thanks! |
Thanks for your review @vincentchalamon! I added a description on the PR to solve that, is it ok for you? |
579d2ea
to
9dce18e
Compare
OK but that doesn't explain to me why this class has been originally added, and why we don't need it anymore. After looking at its history, it looks like a legacy code backported from version to version of api-platform/core for backward compatibility. As discussed with @soyuka, it might be possible this behavior (this interface + To validate this deprecation, I suggest to:
WDYT @soyuka @vinceAmstoutz? |
Thanks for your research @vincentchalamon. After some tests it's ok for me to use the Serializer directly in a State Provider (no exception and seems to have also no circular reference - not sure at 100% for this one) Alos, I updated the PR description by adding your explanation. Is it better? Do not hesitate to improve it on your own if you want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nice to have]
Add a TODO in DataProviderPass
to don't forget to remove it in 5.0
9dce18e
to
88862a4
Compare
…lizableProvider A PR for the removal was already made: api-platform#7314.
88862a4
to
88be17c
Compare
Done. I also added it for |
Co-authored-by: Vincent <[email protected]>
4.2
Made the deprecation before the removal made in #7314.
Reason: Direct access to private services is discouraged because this practice:
That's why PHPStan reported an error, which is ignored by our PHPStan config here: https://github.com/vinceAmstoutz/api-platform-core/blob/9e382e01bb4529d4ae63dbbeda01839d1da2994a/phpstan.neon.dist#L107-L110.
Historic reason:
After looking at its history, it looks like a legacy code backported from version to version of api-platform/core for backward compatibility. As discussed with @soyuka, it might be possible this behavior (this interface + DataProviderPass) was introduced long time ago to prevent a circular reference between any State Provider directly using the Serializer.