読み込み中に symfony twig テンプレートでエラーが発生しました。
これを含める必要がありますか: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
[InvalidArgumentException]
Unable to find template "CrudBundle:email.html.twig".
[Twig_Error_Loader]
Unable to find template "CrudBundle:email.html.twig".
[Twig_Error_Loader]
Unable to find template "CrudBundle:email.html.twig" (looked into: C:\xampp
\htdocs\sample\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resourc
es/views/Form).
これがフォルダ構造です。
src/Btn/CrudBundle/command/SystemCommand.php
: 授業場所
src/Btn/CrudBundle/Resources/views/email.html.twig
: テンプレートの場所
class SystemCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('cron:email:send')
->setDescription('Verifies that accounts');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln("This is a test");
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('sample@sample.com')
->setTo('sample@sample.com')
->setBody(
$this->getContainer()->get('templating')->render(
'CrudBundle:email.html.twig',
array('name' => $staffer->getUser())
)
)
;
$this->get('mailer')->send($message);
}
}
助けてください