asalanka asalanka - 5 months ago 12
PHP Question

I have this error in symfony 2.4.5 BloggerBlogBundle:Blog:show.html.twig

I have this error comes up on Symfony 2.4.5 for symblog tutorial [[Part 4] - The Comments Model: Adding comments, Doctrine Repositories and Migrations], Unexpected token "name" of value "with" ("end of statement block" expected) in BloggerBlogBundle:Blog:show.html.twig. This happend just after updating the blog show template to render the add blog form.

Answer

There was a change after symfony 2.3.

In show.html.twig, change this line:

{% render 'BloggerBlogBundle:Comment:new' with { 'blog_id': blog.id } %}

to:

{{ render(controller( 'BloggerBlogBundle:Comment:new', { 'blog_id': blog.id } )) }}