title: KnpMenuBundle and dynamic route parameter
body: <p>i use knpmenubundle for my website and here is my problem :
  i've a list of user listed by this route : /admin/users
  and the menu is like this :</p>
  
  <pre><code>User (is opened)
      list (is active)
      add new
  </code></pre>
  
  <p>in the list view, the item "<strong>list</strong>" in the menu is active like i want
  in the add new view, the item "<strong>add new</strong>" in the menu is active like i want</p>
  
  <p>but, when i want to edit an user which allready exist, i can't manage to active the item "<strong>Users</strong>" because te route have a dynamic parameter</p>
  
  <p>here is how my site is structured :</p>
  
  <p><strong>in src/dn/AdminBundle/Resources/Config/routing.yml</strong></p>
  
  <pre><code># Users
  ### List
  dnAdmin_usersList:
      pattern: /users/{page}
      defaults: { _controller: dnAdminBundle:User:list, page: 1 }
      requirements:
          page:  \d*
  
  ### Edit
  dnAdmin_userEdit:
      pattern: /user/edit/{id}
      defaults: { _controller: dnAdminBundle:User:edit}
      requirements:
          id: \d+
  </code></pre>
  
  <p><strong>in app/ressources/view/layout/html/twig</strong></p>
  
  <pre><code>{{ render(controller("dnAdminBundle:Common:leftMenu")) }}
  </code></pre>
  
  <p><strong>in src/dn/AdminBundle/Controller/CommonController</strong></p>
  
  <pre><code>public function leftMenuAction()
  {
      return $this-&gt;render('dnAdminBundle:Common:leftMenu.html.twig');
  }
  </code></pre>
  
  <p><strong>in src/dn/AdminBundle/Resources/view/Common/leftMenu/html.twig</strong></p>
  
  <pre><code>{{ knp_menu_render('leftMenu', {'template':'dnAdminBundle:Menu:knp_menu.html.twig', 'currentClass':'active', 'ancestorClass':'active'}) }}
  </code></pre>
  
  <p><strong>in src/dn/AdminBundle/Resources/config/services.yml</strong></p>
  
  <pre><code>services:
      dn_admin.menu_builder:
          class: dn\AdminBundle\Menu\MenuBuilder
          arguments: ["@knp_menu.factory"]
  
      dn_admin.menu.leftMenu:
          class: Knp\Menu\MenuItem
          factory_service: dn_admin.menu_builder
          factory_method: createLeftMenu
          arguments: ["@request"]
          scope: request
          tags:
              - { name: knp_menu.menu, alias: leftMenu }
  </code></pre>
  
  <p><strong>in src/dn/AdminBundle/Menu/MenuBuilder.php</strong>
  namespace dn\AdminBundle\Menu;</p>
  
  <p>use Knp\Menu\FactoryInterface;
  use Symfony\Component\HttpFoundation\Request;
  class MenuBuilder
  {
      private $factory;</p>
  
  <pre><code>/**
   * @param FactoryInterface $factory
   */
  public function __construct(FactoryInterface $factory)
  {
      $this-&gt;factory = $factory;
  }
  
  public function createLeftMenu(Request $request)
  {
      // root
      $menu = $this-&gt;factory-&gt;createItem('root');
      $menu-&gt;setChildrenAttributes(array('class' =&gt; 'sidebar-menu'));
  
      // Users
      $l = $menu-&gt;addChild('Users', array(
          'uri'    =&gt; '#',
      ));
      $l-&gt;setAttribute('class', 'treeview');
      $l-&gt;setChildrenAttribute('class', 'treeview-menu');
      $l-&gt;addChild('Liste', array(
          'route'  =&gt; 'dnAdmin_userList',
      ));
      $l-&gt;addChild('Edit', array(
          'route'           =&gt; 'dnAdmin_userEdit',
          'routeParameters' =&gt; $request-&gt;get('id'),
      ))
      -&gt;setDisplay(false);
  }
  </code></pre>
  
  <p>but <strong>$request->get('id')</strong> return empty string</p>
  
  <p>Anyone have idea on how i can get the current parameter in knpmenubundle?</p>
  
  <p>Thanks</p>