[英]Symfony2 error: The service “templating” has a dependency on a non-existent service “templating.globals”
I have just installed a bundle using the following command to activate Mustache templates in my project but now I get the following error; 我刚刚使用以下命令安装了一个捆绑包,以在项目中激活Mustache模板,但是现在出现以下错误;
The service "templating" has a dependency on a non-existent service "templating.globals". 服务“模板”依赖于不存在的服务“ templating.globals”。
The command I used was: 我使用的命令是:
composer.phar require bobthecow/mustache-bundle composer.phar需要bobthecow / mustache-bundle
Of course I know I am missing the templating.globals service but How do I include this and why is it not included automatically? 当然,我知道我缺少templating.globals服务,但是如何包含它,为什么不自动包含它呢?
The templating.globals
service is only created by the symfony/framework-bundle
if you have php
in the list on templating engines. 如果您在模板引擎列表中有
php
,则templating.globals
服务仅由symfony/framework-bundle
创建。
As you can see in the Resources/config/templating_php.xml
the service is created. 如您在
Resources/config/templating_php.xml
看到的那样,该服务已创建。
This file is only loaded in the extension if php
is in the list of templating engines . 如果
php
在模板引擎列表中,则仅在扩展名中加载此文件。
TL;DR Add php
to the templating engines in your app/config/config.yml
. TL; DR将
php
添加到app/config/config.yml
的模板引擎中。
# app/config/config.yml
framework:
# ...
templating:
engines: ['twig', 'php']
If you are running Symfony 4.x then You've to add the following to the config/packages/framework.yaml: 如果您正在运行Symfony 4.x,则必须将以下内容添加到config / packages / framework.yaml中:
framework:
# ... other stuff ...
templating:
engines: ['twig', 'php']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.