Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] Revert deprecation ofContextAwareEncoderInterface andContextAwareDecoderInterface#47150
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
… `ContextAwareDecoderInterface`
afca338 to9ac7fb1Comparechalasr commentedAug 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'm not sure about this given these interfaces were just about surcharging the method signatures with an extra |
nicolas-grekas commentedAug 2, 2022
If we pass a context to supports method, we have to consider that context can be taken into account, aka we have to remove the cache. Adding yet another interface for cacheable supports feels like renaming interface for the sake of it. Until 6.1, supports method were expected to receive only one argument, the format. That made them cacheable. ContextAware interfaces were here to tell that the context could be used, and we forgot to make those instances uncacheable. I feel like we already have everything in place to properly deal with the issue. |
nicolas-grekas commentedAug 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
(Note that I would go one step further in 6.2 and deprecate passing the |
chalasr commentedAug 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
That would be a big code smell to me, really.
Caching support is a different feature, making it explicit would not be a bad thing imho.
But we did that change for a reason, mainly usability. Pretty much all implementations want the context (not always for caching, I'd even say it's the minority), and they end up implementing those interfaces for that just because we weren't able to add a new method parameter to an existing interface at that time, which added some extra complexity for the developer. |
nicolas-grekas commentedAug 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
On the contrary: the possibilty of caching is a consequence of the design. A design should not be tailored to any specific use case (eg caching). Instead, proper design should lead to abstractions that empower end users to do what they need. Eg caching.
See my previous note.
None of the core encoders use the context to decide in |
chalasr commentedAug 2, 2022
I'm sorry but I disagree. These interfaces were not meant to add any behavior but to allow some various metadata to transit, which is something that almost any encoder/normalizer need hence it is not worth such a dedicated abstraction which appears to be annoying to most. Applications using the serializer usually have custom encoders and normalizers so it's not only impacting the built-in ones. |
nicolas-grekas commentedAug 2, 2022
Relying on Undeprecating in 6.1 is a must to me. If we like to re-deprecate in 6.2, we must do so while providing a viable alternative. |
chalasr commentedAug 2, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
And deprecating is a must to me... which I'd prefer not doing twice for obvious reasons. Linking to#43982 btw to know about these interfaces purpose and the motivation behind removing them. |
dunglas commentedAug 2, 2022
I also prefer introducing a new dedicated interface instead of re-introducing this hacky interface that I introduced initially to fix an older bad design choice that was annoying for many use cases. |
chalasr commentedAug 21, 2022
Thanks for your patience and your consideration on the fact that deprecating these interfaces comes with relevant motivations. |
chalasr commentedAug 21, 2022
Thank you@nicolas-grekas. |
…n ChainEncoder/ChainDecoder (Guite)This PR was merged into the 4.4 branch.Discussion----------[Serializer] Fix caching context-aware encoders/decoders in ChainEncoder/ChainDecoder| Q | A| ------------- | ---| Branch? | 4.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#38270| License | MIT| Doc PR | -As proposed in#43231 (comment)Will require#47150 on 6.1 until a proper solution is implemented, hopefully in 6.2.Commits-------5902380 [Serializer] Fix caching context-aware encoders/decoders in ChainEncoder/ChainDecoder
This PR was merged into the 6.1 branch.Discussion----------remove upgrade instructions leftovers of#47150| Q | A| ------------- | ---| Branch? | 6.1| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets || License | MIT| Doc PR |This PR corrects that#47150 has not been reflected in the UPGRADE doc.Commits-------dc07bdf remove wrong entries for#47150
* 6.1: remove wrong entries for#47150 Fix LocaleListenerTest Accept-Language headers
Uh oh!
There was an error while loading.Please reload this page.
While reviewing#43231, I figured out that the correct fix for#38270 was to make
ChainEncoderproperly considerContextAwareEncoderInterfacewhen deciding to cache or not.Since this interface is useful to discriminate the cache/no-cache situations, we have to undeprecate it (from#43982.)
/cc@Guite and@mtarld FYI