Q:

Symfony2 Exception Thrown During Rendering

everyone! I've been following this tutorial: tutorial.symblog.co.uk on Symfony2 for a while now... The only problem is that the tutorial is very old and includes many deprecated, and even removed functions that I have to fix myself.
Anyways, I guess it "builds character". ;-)
I recently came across another problem that I couldn't fix, So, I thought to myself, "Why not ask the amazing people on stack?" So, I am...
I'm trying to render a template with twig, and it's throwing the following error:
An exception has been thrown during the rendering of a template ("No route found for "GET Comment:create"") in BloggerBlogBundle:Blog:show.html.twig at line 26.
500 Internal Server Error -

Here's the twig file:
{# src/Blogger/BlogBundle/Resources/views/Blog/show.html.twig #}
{% extends 'BloggerBlogBundle::layout.html.twig' %}

{% block title %}{{ blog.title }}{% endblock %}

{% block body %}
    <article class="blog">
        <div class="date"><time datetime="{{ blog.created|date('c') }}">{{ blog.created|date('l, F j, Y') }}</time></div>
        <h2>{{ blog.title }}</h2>
    </article><br>
    {% if asset_exists(['images/', blog.image]|join) %}
        <img src="{{ asset(['images/', blog.image]|join) }}" alt="{{ blog.title }} image not found" class="large" />
    {% endif %}
    <div>
        <p>{{ blog.blog }}</p>
    </div>
    <footer>
        <p>Created by: {{ blog.author }}</p>
    </footer>
    <section class="comments" id="comments">
        <section class="previous-comments">
            <h3>Comments</h3>
            {% include 'BloggerBlogBundle:Comment:index.html.twig' with { 'comments': comments } %}
        </section>
        <h3>Add Comment</h3>
        {% render 'BloggerBlogBundle:Comment:create' %}
    </section>
{% endblock %}

And the CommentController:
<?php
// src/Blogger/BlogBundle/Controller/CommentController.php

namespace Blogger\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Blogger\BlogBundle\Entity\Comment;
use Blogger\BlogBundle\Form\CommentType;

/**
 * Comment controller.
 */
class CommentController extends Controller {
    public function newAction($blog_id) {
        $blog = $this->getBlog($blog_id);

        $comment = new Comment();
        $comment->setBlog($blog);
        $form = $this->createForm(new CommentType(), $comment);

        return $this->render('BloggerBlogBundle:Comment:form.html.twig', array(
            'comment' => $comment,
            'form' => $form->createView()
        ));
    }

    public function createAction($blog_id) {
        $blog = $this->getBlog($blog_id);

        $comment = new Comment();
        $comment->setBlog($blog);
        $request = $this->getRequest();
        $form = $this->createForm(new CommentType(), $comment);
        $form->bind($request);

        if ($form->isValid()) {
            // TODO: Persist the comment entity

            return $this->redirect($this->generateUrl('BloggerBlogBundle_blog_show', array(
                'id' => $comment->getBlog()->getId())) .
                '#comment-' . $comment->getId()
            );
        }

        return $this->render('BloggerBlogBundle:Comment:create.html.twig', array(
            'comment' => $comment,
            'form' => $form->createView()
        ));
    }

    protected funciton getBlog($blog_id) {
        $em = $this->getDoctrine()
                   ->getManager();

        $blog = $em->getRepository('BloggerBlogBundle:Blog')->find($blog_id);

        if (!$blog) {
            throw $this->createNotFoundException('Unable to find Blog post.');
        }

        return $blog;
    }
}

And, the view for the comments:
{# src/Blogger/BlogBundle/Resources/views/Comment/create.html.twig #}

{% extends 'BloggerBlogBundle::layout.html.twig' %}

{% block title %}Add Comment{% endblock %}

{% block body %}
    <h1>Add comment for blog post "{{ comment.blog.title }}"</h1>
    {% include 'BloggerBlogBundle:Comment:form.html.twig' with { 'form' : form } %}
{% endblock %}

As always, thanks in advance!

A:

You're missing the controller() around the path that you're referencing
{{ render(controller('BloggerBlogBundle:Comment:create', {'var1': var1, 'var2': var2})) }}

You also have to use {{ }} and not {% %} since you're outputting the render. Here's the Symfony2 docs on embedding other controllers in a Twig template.
Without the controller() method, Symfony will try to load the resource by using BloggerBlogBundle:Comment:create as a route and not a direct access to the controller method like you're trying to do.

