fos_comment_get_threads: unable to find template ""
arodiss opened this issue · 2 comments
Hello and thank you for creating this awesome bundle.
I attached it to my project without even understanding what all this means and magically everything works - really impressive.
However, in logs sometimes I see error like this
Matched route "fos_comment_get_threads" (...)
Route parameters: (...) _format: html (...)
Unable to find template "" (...)
(in stacktrace section)
at TwigEngine ->load (null)
at TwigEngine ->render (null, array('threads' => array()))
at ViewHandler ->renderTemplate (object(View), 'html')
(...)
I called URL /api/threads.html
in browser directly and see this error indeed.
Have no idea where this request comes from - as I said, actual functionality is working for me
But looks like the problem is that ThreadController::getThreadsActions()
(shouldn't it be "action" without "s"?) does not call $view->setTemplate()
which is OK for JSON but not OK for HTML
EDITED
I worked around this issue by adding instruction to redirect this specific URL to my landing at the very top of routing.
I still have no idea where this nonsense requests are coming from (web spiders?.. weird browser extension?..) but at least I don't have those annoying error logs.
I also noticed that basically /api/threads.whatever
is considered to be a request for threads in whatever
format - and it throws error on everything but JSON and XML. Maybe actually a FOSREST issue
Seems related to FOSRestBundle configuration, see https://stackoverflow.com/questions/18010784/fos-rest-bundle-unable-to-find-template