On 01.01.2011, at 20:22, Jay wrote:
> We are attempting to send out emails from within a command line script
> and the content of the email is in a twig template. We tried this
> approach which is the code I found within the sf2 controller
> renderView method:
>
> $rendered = $this->container->get('templating')-
>> render('ProgramBundle:Frontend:daily-email.twig', array(
> 'user' => $user,
> ));
>
> However, we get this error:
>
> PHP Fatal error: Call to a member function getRequestFormat() on a
> non-object in /data/sites/exercise-deploys/
> 2010-12-31_19-29-32_codebase/exercise/cache/prod/classes-ba4e4.php on
> line 524
>
> Fatal error: Call to a member function getRequestFormat() on a non-
> object in /data/sites/exercise-deploys/2010-12-31_19-29-32_codebase/
> exercise/cache/prod/classes-ba4e4.php on line 524
>
>
> Any ideas how to render a twig template from within a command line
> script with sf2?
>
you need to specify the format explicitly in the template name:
ProgramBundle:Frontend:daily-email.[format].twig
For example:
ProgramBundle:Frontend:daily-email.html.twig
Otherwise SF2 will attempt to autodetect the format, which atm is only
supported in the HTTP Kernel.
regards,
Lukas Kahwe Smith
[email protected]
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en