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-
You need to set the container into the right scope and give it a (fake) request. In most cases this will be enough:
//before you render template add bellow code
$this->getContainer()->enterScope('request');
$this->getContainer()->set('request', new Request(), 'request');
The full story is here. If you want to know the details read this issue on github.