Delete from database in Symfony 2
<p>I am trying to use a delete function for Symfony 2, which gives me an error</p>

<p>Routing.yml</p>

<pre><code>home_homepage_deleteuser:
   path:   /homepage/delete_users/{id}
   defaults: {_controller: HomeHomepageBundle:Default:deleteuser}
   methods: [GET, POST]
</code></pre>

<p>Defaultcontroller.php</p>

<pre><code> public function deleteuseraction(Users $users)
    {
        $em = $this-&gt;getDoctrine()-&gt;getManager();
        $users = $em -&gt; getRepository('LoginLoginBundle:Users')-&gt;find($idusers);
        $em-&gt; remove($users);
        $em -&gt; flush();

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

<p>Userlist.html.twig</p>

<pre><code>&lt;a href="{{ path('home_homepage_deleteuser') }}" 
class="btn btn-danger pull-right"&gt;Delete&lt;/a&gt;                             
</code></pre>

<p><a href="http://i.stack.imgur.com/LY6i0.png" rel="nofollow">Display</a></p>