[英]Symfony Serializer: setCircularReferenceHandler() is deprecated
Symfony's (FrameworkBundle v4.2.5) serializer component (v4.2.5) now tells me in the logs: Symfony的(FrameworkBundle v4.2.5)序列化程序组件(v4.2.5)现在在日志中告诉我:
php.INFO: User Deprecated: The "Symfony\Component\Serializer\Normalizer\AbstractNormalizer::setCircularReferenceHandler()" method is deprecated since Symfony 4.2, use the "circular_reference_handler" key of the context instead.
But the thing is, I don't call this method explicitly. 但问题是,我没有明确调用此方法。 This call is actually triggered by the SymfonyFrameworkBundle.
该调用实际上是由SymfonyFrameworkBundle触发的。
I have this in my framework.yaml: 我在我的framework.yaml中有这个:
serializer:
enabled: true
circular_reference_handler: Cbp\Utils\CircularReferenceHandler
And I see this in the FrameworkExtension (which is provided by the FrameworkBundle): 我在FrameworkExtension(由FrameworkBundle提供)中看到了这一点:
if (isset($config['circular_reference_handler']) && $config['circular_reference_handler']) {
$container->getDefinition('serializer.normalizer.object')->addMethodCall('setCircularReferenceHandler', [new Reference($config['circular_reference_handler'])]);
}
So my question is: how do I fix this deprecation notice? 所以我的问题是:如何解决此弃用通知?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.