您请求了一个不存在的服务“模板" [英] You have requested a non-existent service "templating"

查看:24
本文介绍了您请求了一个不存在的服务“模板"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让 FOSOAuthServerBundle 用于我的项目运行 symfony 3.4.0

i'm trying to get FOSOAuthServerBundle to work on my project Running symfony 3.4.0

模板似乎丢失了,但我在谷歌上找不到任何关于它的信息.知道它可能是什么吗?否则树枝工作正常

templating seems to be missing but i can't find anything about it on google. any idea what it could be? twig is working perfectly otherwise

我已经清除了缓存从 3.4.1 降级到 3.4.0

i've cleared the cache downgraded from 3.4.1 to 3.4.0

授权控制器.php>

AuthorizeController.php >

return $this->container->get('templating')->renderResponse(
        'FOSOAuthServerBundle:Authorize:authorize.html.'.$this->container->getParameter('fos_oauth_server.template.engine'),
        array(
            'form'   => $form->createView(),
            'client' => $this->getClient(),
        )
);

这是它崩溃的地方.

推荐答案

我假设您正在使用 Symfony Flex,因为它具有这种极简主义的方法,它没有附带 twig,这是 Symfony 的默认模板系统.

I'm assuming you're using Symfony Flex, since it has this minimalist approach it doesn't come with twig, which is the default templating system for Symfony.

请通过以下方式安装:

composer require twig

无论如何,如果您已经安装了 twig 但它不起作用,请确保您的配置使其可用:

In any case if you have already twig installed but it's not working, make sure your configurations has it available:

# app/config/config.yml

framework:
    # ...
    templating:
        engines: ['twig']

这篇关于您请求了一个不存在的服务“模板"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆