控制台调用(如缓存清除或behat)会抛出异常,但在浏览器中一切正常


Console calls (like cache clears or behat) throw an exception but all is fine in browser

我正在创建一个Symfony2应用程序,一切都很好,但当我尝试执行behat测试或清除缓存时,我得到了以下错误:

Error: Call to undefined method
Symfony'Bundle'FrameworkBundle'Templating'Loader'TemplateLocator::isFresh() in 
[...]/vendor/symfony/assetic-
bundle/Symfony/Bundle/AsseticBundle/Factory/Resource/FileResource.php line 49

TemplateLocator甚至没有实现LoaderInterface,这在FileResource构造中是必需的。有人知道线索吗?

我弄清楚了问题的来源,但没有理解。在我的应用程序中,似乎有一个地方我称之为

$this->container->get('twig')->render("Bundle:View:action.html.twig")

我换了

$this->container->get('templating')->render("Bundle:View:action.html.twig")

twitch服务是twig_Environment实例,template是DelegatingEngine实例,两者都允许呈现模板。一切又好起来了。如果有人能向我解释发生了什么,我将不胜感激:)