Symfony2 Templating without request

前端 未结 4 2098
Happy的楠姐
Happy的楠姐 2021-02-15 12:14

I\'m trying to send an email from a ContainerAwareCommand in Symfony2. But I get this exception when the email template is render by:

$body = $this-         


        
4条回答
  •  野性不改
    2021-02-15 13:01

    Since you don't have a request, you need to call the templating service directly like this:

    $this->container->get('templating')->render($template, $data);
    

提交回复
热议问题