2

読み込み中に 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);          
    }
}

助けてください

4

1 に答える 1

2

CrudBundle::email.html.twigの代わりに試してくださいCrudBundle:email.html.twig

于 2013-03-21T14:14:13.130 に答える