title: Get URL variable in twig
body: <p>I have the authentification controller </p>
  
  <pre><code>public function indexAction(Request $request)
  {
  
  $em = $this-&gt;getDoctrine()-&gt;getEntityManager();
  $repository = $em-&gt;getRepository('Mql14mqlmeBundle:User');
  
     if ('POST' === $request-&gt;getMethod()) {
          $username = $request-&gt;get('login');
      $password = $request-&gt;get('pass');
            if(($username=='admin')&amp;&amp;($password=='admin')){
  
             return $this-&gt;redirect($this-&gt;generateUrl('mql14mqlme_admin',  array('name' =&gt; 'welcome')));
              }
  
      $user = $repository-&gt;findOneBy(array('login' =&gt; $username, 'pass' =&gt;  $password));
  
      if ($user) {
  
          return $this-&gt;redirect($this-&gt;generateUrl('mql14mqlme_acceuil', array('name' =&gt; $user-&gt;getNom(),
                  'id'=&gt; $user-&gt;getId(),
              )));
  
  
      }else {
        return $this-&gt;redirect($this-&gt;generateUrl('mql14mqlme_homepage', array('name' =&gt;$username)));
    }
  </code></pre>
  
  <p>If the user has provided the right login and password he is redirected to acceuil twig, in this twig I want to get the user's id to use it in another twig, so the line where I have a problem is this:</p>
  
  <pre><code>&lt;a href="{{ path('mql14mqlme_interet', { 'id': name   }) }}"&gt;INTERETS&lt;/a&gt;
  </code></pre>
  
  <p>the error I get is:Variable "name" does not exist in Mql14mqlmeBundle:Default:acceuil.html.twig at line 89 </p>
  
  <p>The action code for acceuil:</p>
  
  <pre><code>public function acceuilAction()
  {
  
  $em = $this-&gt;container-&gt;get('doctrine')-&gt;getEntityManager();
  $evenements= $em-&gt;getRepository('Mql14mqlmeBundle:Evenement')-&gt;findAll();
  $categories= $em-&gt;getRepository('Mql14mqlmeBundle:Categorie')-&gt;findAll();
  return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('Mql14mqlmeBundle:Default:acceuil.html.twig',
          array(
                  'evenements' =&gt; $evenements,
                  'categories' =&gt; $categories
          ));
  
  }   
  </code></pre>