我收到了这个弃用错误,但我无法弄清楚它的来源。我正在使用Symfony 2.8.2和CMF Routing 1.3。
这是错误:
The hardcoded value you are using for the $referenceType argument of the Symfony\Component\Routing\Generator\UrlGenerator::generate method is deprecated since version 2.8 and will not be supported anymore in 3.0. Use the constants defined in the UrlGeneratorInterface instead. Hide stack trace
UrlGenerator::doGenerate() (called from appDevUrlGenerator.php at line 95)
appDevUrlGenerator::generate() (called from classes.php at line 1284)
Router::generate() (called from ChainRouter.php at line 231)
ChainRouter::generate() (called from WebDebugToolbarListener.php at line 68)
WebDebugToolbarListener::onKernelResponse() call_user_func() (called from WrappedListener.php at line 61)
WrappedListener::__invoke() call_user_func() (called from classes.php at line 1853)
EventDispatcher::doDispatch() (called from classes.php at line 1771)
EventDispatcher::dispatch() (called from TraceableEventDispatcher.php at line 132)
TraceableEventDispatcher::dispatch() (called from HttpKernel.php at line 179)
HttpKernel::filterResponse() (called from HttpKernel.php at line 161)
HttpKernel::handleRaw() (called from HttpKernel.php at line 62)
HttpKernel::handle() (called from ContainerAwareHttpKernel.php at line 69)
ContainerAwareHttpKernel::handle() (called from Kernel.php at line 185)
Kernel::handle() (called from app_dev.php at line 30)
require() (called from router_dev.php at line 40)
从我的代码中我不会在任何地方调用doGenerate()。也许Symfony CMF路由组件正在某个地方呼叫?我应该在哪里查找此错误?
答案 0 :(得分:2)
你应该搜索router-> generate(调用其中第三个参数不是UrlGeneratorInterface的常量(可能是在供应商代码库中)。哦,看看http://github.com/symfony-cmf/Routing/blob/1.3.0/ChainRouter.php#L214 ...默认值是错误的因此,如果你没有在每次触发弃用通知时都给出第3个参数。它由#158修复,但没有在稳定版本(仅限RC)中重新定标,当它出现时它将在1.4中。