-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Use DenormalizerAwareInterface instead of SerializerAwareInterface #52764
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: 7.4
Are you sure you want to change the base?
Conversation
The UnwrappingDenormalizer does not depend on the SerializerInterface. Using the DenormalizerInterfacce is enough, because only denormalize is called. Also, the SerializerInterface does not define method denormalize and it currently only works, because at runtime the serializer service is injected, which implements the DenormalizerInterface.
This is a breaking change that we need a deprecation layer for. By removing |
Hi @derrabus,
You are right, I missed this. I am going to add a deprecation layer. |
94663b7
to
c4542ef
Compare
c4542ef
to
4dea4e0
Compare
|
||
/** | ||
* @author Eduard Bulava <bulavaeduard@gmail.com> | ||
*/ | ||
final class UnwrappingDenormalizer implements DenormalizerInterface, SerializerAwareInterface |
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.
I think we should keep SerializerAwareInterface
as long as we implement setSerializer()
.
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.
If we implement SerializerAwareInterface, the Serializer class will be calling the deprecated method.
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.
Yes, that's the reason why I removed SerializerAwareInterface
. The Serializer
class will call setSerializer()
here: https://github.com/symfony/symfony/blob/7.1/src/Symfony/Component/Serializer/Serializer.php#L85
But without it, its a bc-break for code relying on UnwrappingDenormalizer
implementing SerializerAwareInterface
. I am not sure how to solve this problem.
The
UnwrappingDenormalizer
does not depend on theSerializerInterface
. Using theDenormalizerInterfacce
is enough, because onlydenormalize()
is called. Also, theSerializerInterface
does not define methoddenormalize()
and it currently only works, because at runtime theserializer
service is injected, which implements theDenormalizerInterface
.