twig - Symfony, error: An exception has been thrown during the rendering -
the full error getting one.
an exception has been thrown during rendering of template ("some mandatory parameters missing ("id") generate url route "fooblogbundle_articles".") in "fooblogbundle:article:articles.html.twig".
this controller, handles action:
public function articlesaction($id) { $em = $this->getdoctrine()->getmanager(); $blog = $em->getrepository('fooblogbundle:blog')->find($id); if(!$em){ throw $this->createnotfoundexception('unable find blog posti'); } return $this->render('fooblogbundle:article:articles.html.twig', ['blog'=>$blog]); } }
and routing
flickblogbundle_articles: pattern: /foo/{id} defaults: { _controller: fooblogbundle:article:articles } requirements: _method: id: \d+
twig , database, normal, no type or problems. error kind of hard spot, have gone wrong.
edit: including template:
{% extends 'fooblogbundle::layout.html.twig' %} {% block body %} {{ blog.title }}<br/> {{ blog.author }}<br/> {{ blog.blog }}<br/> {{ blog.tags }}<br/> {{ blog.comments }} {% endblock %}
the above template located in views/article/
extends templates found @ views/
whic
{% extends 'fooblogbundle::layout.html.twig' %}
in fooblogbundle:article:articles.html.twig
template have {{ path(flickblogbundle_articles) }}
(can not tell because not see template). route requires additional parameter id
. change {{ path(flickblogbundle_articles, {'id':article.id}) }}
Comments
Post a Comment