Delete method Symfony
<p>After trying to create a delete method, I am experiencing the following error:</p>

<pre><code>An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("id") to generate a URL for route "movie_delete".") in movies/index.html.twig at line 10.
</code></pre>

<p>The code I am using:
Twig template:</p>

<pre><code>{% extends 'base.html.twig' %}

{% block body %}
    {% if movies|length == 0 %}
        There are no movie items available. Add a movie &lt;a href="{{ path('movie_create_form') }}"&gt;here&lt;/a&gt; to get started.
    {% elseif movies|length != 0 %}
        These are the results: &lt;br /&gt;
        &lt;ul&gt;
            {% for x in movies %}
                &lt;li&gt;Title: {{ x.title }}  - Price: {{ x.price }} - &lt;a href="#"&gt;Edit&lt;/a&gt; - &lt;a href="{{ path('movie_delete') }}{{ x.id }}"&gt; Delete&lt;/a&gt;&lt;/li&gt;
            {% endfor %}
        &lt;/ul&gt;
        &lt;a href="{{ path('movie_create_form') }}"&gt;Add more movie entries&lt;/a&gt;
    {% endif %}
{% endblock %}
</code></pre>

<p>Delete class:</p>

<pre><code>&lt;?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

use AppBundle\Entity\Movie;

class MovieDeleteController extends Controller
{

    public function deleteAction($id)
    {
        $em = $this-&gt;getDoctrine()-&gt;getManager();

        if(!$id)
        {
            throw $this-&gt;createNotFoundException('No ID found');
        }

        $movie = $this-&gt;getDoctrine()-&gt;getEntityManager()-&gt;getRepository('AppBundle:Movie')-&gt;Find($id);

        if($movie != null)
        {
            $em-&gt;remove($movie);
            $em-&gt;flush();
        }

        return $this-&gt;redirectToRoute('movies');
    }
}
</code></pre>

<p>And my routing.yml:</p>

<pre><code>movie_delete:
    path:     /movies/delete/{id}
    defaults: { _controller: AppBundle:MovieDelete:delete }
</code></pre>

<p>Can anyone explain me how I should add a Delete method in Symfony so that I can apply the change in the above written code?</p>