什么是模板服务 ID? [英] What the templating service ID?

查看:75
本文介绍了什么是模板服务 ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将模板 EngineInterface 传递给构造函数.

I want to pass the templating EngineInterface to constructor.

因为,我想从不是控制器类的类中使用 renderView().

Since ,I want to use renderView() from the class which is not controller class.

public function __construct(FormInterface $form, Request $request, UserManagerInterface $userManager, MailerInterface $mailer,TokenGeneratorInterface $tokenGenerator,GroupManagerInterface $groupManager,EngineInterface $templating)
{

    parent::__construct($form, $request, $userManager, $mailer,$tokenGenerator);
    $this->groupManager = $groupManager;  
    $this->templating = $templating;
}

我当前的service.xml是这个

my current service.xml is this

    <service id="acme_user.registration.form.handler" class="Acme\UserBundle\Form\Handler\RegistrationFormHandler" scope="request" public="false">  
        <argument type="service" id="fos_user.registration.form" />  
        <argument type="service" id="request" />  
        <argument type="service" id="fos_user.user_manager" />  
        <argument type="service" id="fos_user.mailer" />
        <argument type="service" id="fos_user.util.token_generator" />
        <argument type="service" id="fos_user.group_manager" />  
        <argument type="service" id="****" />  <!-- what is templating service iD?  
    </service> 

什么是模板服务 ID?

What is the templating service ID?

一般来说,我怎样才能找到服务 ID?

and generally speaking,how can I find the service id ?

推荐答案

您可能正在寻找:

<argument type="service" id="templating"/>

这篇关于什么是模板服务 ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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