Symfony 2:模板应该是字符串或扩展TemplateReference

时间:2014-12-15 11:36:02

标签: symfony twig

我没有找到关于&#34的任何重要帮助;模板应该是字符串或扩展TemplateReference"在我的Symfony2项目中,所以我想知道周围是否有人,谁遇到了上述问题。

堆栈追踪:

InvalidArgumentException: The template should be a string or extend TemplateReference
at n/a
    in /home/test/apps/test_admin/dev/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/View/View.php line 178

at FOS\RestBundle\View\View->setTemplate(object(Template))
    in /home/test/apps/test_admin/dev/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/EventListener/ViewResponseListener.php line 128

at FOS\RestBundle\EventListener\ViewResponseListener->onKernelView(object(GetResponseForControllerResultEvent))
    in  line 

at call_user_func(array(object(ViewResponseListener), 'onKernelView'), object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 460

at Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->Symfony\Component\HttpKernel\Debug\{closure}(object(GetResponseForControllerResultEvent))
    in  line 

at call_user_func(object(Closure), object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/app/cache/dev/classes.php line 1656

at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(Closure)), 'kernel.view', object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/app/cache/dev/classes.php line 1589

at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/app/cache/dev/classes.php line 1753

at Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/TraceableEventDispatcher.php line 139

at Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent))
    in /home/test/apps/test_admin/dev/app/bootstrap.php.cache line 2906

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
    in /home/test/apps/test_admin/dev/app/bootstrap.php.cache line 2877

at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
    in /home/test/apps/test_admin/dev/app/bootstrap.php.cache line 3006

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
    in /home/test/apps/test_admin/dev/app/bootstrap.php.cache line 2286

at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
    in /home/test/apps/test_admin/dev/web/app_dev.php line 28

更新

我应用了以下修复,但仍然没有运气: https://github.com/FriendsOfSymfony/FOSRestBundle/commit/d2e9aaca8128bfcbd7cd0cb8a80ae34ab71b0c7e

1 个答案:

答案 0 :(得分:0)

好的,我把这一个整理好了。 所以,问题是我的FOSRestBundle依赖关系不是最新的。因此,一旦我更新它,问题就解决了。

感谢所有有兴趣帮助我的人。 :)