更新到Symfony 2.8后,我发现了这个弃用警告:
来自synfony profiler的从版本2.8和版本开始,不推荐使用容器范围的概念 将在3.0中删除。省略第三个参数。 (5次)
堆栈:
Container::set() (called from bootstrap.php.cache at line 2284)
Container::leaveScope() (called from bootstrap.php.cache at line 3309)
ContainerAwareHttpKernel::handle() (called from InlineFragmentRenderer.php at line 85)
InlineFragmentRenderer::render() (called from AbstractSurrogateFragmentRenderer.php at line 67)
AbstractSurrogateFragmentRenderer::render() (called from FragmentHandler.php at line 136)
FragmentHandler::render() (called from LazyLoadingFragmentHandler.php at line 75)
LazyLoadingFragmentHandler::render() (called from HttpKernelExtension.php at line 76)
HttpKernelExtension::renderFragmentStrategy() (called from 75b45c481663ac387bc00d9fd8410a46d20e8cbd1078cf7080b74c14e0f1646d.php at line 150)
__TwigTemplate_7076dec1ac0b55b511bbafc8efae5ac640a2c81a9440de2d401f56087dac1203::doDisplay() (called from classes.php at line 7070)
Twig_Template::displayWithErrorHandling() (called from classes.php at line 7051)
Twig_Template::display() (called from d6304ceab492b2a79d826c9d0750a0561bd3706805e4b6ba8f6631e642482647.php at line 133)
__TwigTemplate_980e572e5866e3173c00b4eb28b4e98ddd449060d3a5249c89569efd2680ba06::block_body() (called from classes.php at line 6966)
Twig_Template::displayBlock() (called from a77399988fd8ed31a7e604fea362bdf6567e5faa69fc6b586cbc010a644f717a.php at line 106)
__TwigTemplate_bf78b5c026524d55ca52358963b690a762081ab3d9e87942755d0900f1be6071::doDisplay() (called from classes.php at line 7070)
Twig_Template::displayWithErrorHandling() (called from classes.php at line 7051)
Twig_Template::display() (called from d6304ceab492b2a79d826c9d0750a0561bd3706805e4b6ba8f6631e642482647.php at line 32)
__TwigTemplate_980e572e5866e3173c00b4eb28b4e98ddd449060d3a5249c89569efd2680ba06::doDisplay() (called from classes.php at line 7070)
Twig_Template::displayWithErrorHandling() (called from classes.php at line 7051)
Twig_Template::display() (called from classes.php at line 7058)
Twig_Template::render() (called from TwigEngine.php at line 50)
TwigEngine::render() (called from TwigEngine.php at line 72)
TwigEngine::render() (called from TwigEngine.php at line 97)
TwigEngine::renderResponse() (called from Controller.php at line 185)
如何修复此弃用?
答案 0 :(得分:4)
如果您想修复请求范围,请从服务声明中删除范围,并将 request_stack 服务注入您的服务。 如果您想修复原型范围,请根据http://symfony.com/doc/2.8/cookbook/service_container/shared.html
进行更改