我刚刚使用以下命令安装了一个包以在我的项目中激活 Mustache 模板,但现在我收到以下错误;
服务“templating”依赖于一个不存在的服务“templating.globals”。
我使用的命令是:
composer.phar 需要 bobthecow/mustache-bundle
当然我知道我缺少 templating.globals 服务,但我如何包含它以及为什么它没有自动包含?
最佳答案
templating.globals
服务仅由 symfony/framework-bundle
创建,前提是您在模板引擎的列表中有 php
。
正如您在 Resources/config/templating_php.xml
中看到的那样服务已创建。
此文件仅在 php
is in the list of templating engines 时加载到扩展名中.
TL;DR 将 php
添加到您的 app/config/config.yml
中的模板引擎。
# app/config/config.yml
framework:
# ...
templating:
engines: ['twig', 'php']
关于php - Symfony2 错误 : The service "templating" has a dependency on a non-existent service "templating.globals",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33404302/