title: Open a modal with dynamic value [symfony2]
body: <p>I have a page that display the user products, a user can edit a product. If the the user click on the button edit he will be redirect to the edit page : <code>http://127.0.0.1/symfony/web/app_dev.php/post/125</code> 
  I would like to display the edit form in a modal so the user will not be redirect.</p>
  
  <p>I have the following error:</p>
  
  <blockquote>
    <p>An exception has been thrown during the rendering of a template ("The
    identifier id is missing for a query of Xxx\XxxxxBundle\Entity\Post")
    in src\Xxx\XxxxxBundle\Resources\views\Post\index.html.twig at line
    404.</p>
  </blockquote>
  
  <p><strong>My link was like this:</strong></p>
  
  <pre><code>&lt;div class="action"&gt;
  &lt;a href="{{ path('post_edit', { 'id': entity.id }) }}" class="buttonModal button btn-small full-width"&gt;EDIT&lt;/a&gt;                                                                                       
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>I changed it to:</strong></p>
  
  <pre><code>&lt;div class="action"&gt;
  &lt;a href="#" class="buttonModal button btn-small full-width"&gt;EDIT&lt;/a&gt;                                                                                       
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>This is how I render my controller in my modal:</strong></p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="cd-user-modal"&gt;
              &lt;div class="cd-user-modal-container"&gt; 
                  &lt;div id="cd-signup"&gt;
                      &lt;div class="col-sm-12 col-sm-offset-2 form-box"&gt;
                          &lt;div class="form-bottom"&gt;  
  
                        {{render(controller('FLYBookingsBundle:Post:edit')) }}
  
                          &lt;/div&gt;
                      &lt;/div&gt; 
                  &lt;/div&gt; 
              &lt;/div&gt; 
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>This is the edit form:</strong></p>
  
  <pre><code>&lt;form action="{{ path('post_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}&gt;
      {{ form_errors(edit_form) }}
      &lt;div class="row"&gt;
  
          &lt;div class="col-md-3"&gt;
  
              &lt;div class="form-group form-group-lg form-group-icon-left"&gt;
                  &lt;i class="fa fa-phone input-icon"&gt;&lt;/i&gt;
                  &lt;label&gt;Phone number&lt;/label&gt;
                  {{ form_widget(edit_form.telephone, {'type':'phone' ,'attr': {'id': 'phone','class': 'form-control phone',} }) }} {{ form_errors(edit_form.telephone) }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="col-md-7"&gt;
              &lt;div class="form-group form-group-lg form-group-icon-left"&gt;
                  &lt;i class="fa fa-map-marker input-icon"&gt;&lt;/i&gt;
                  &lt;label&gt;Address&lt;/label&gt;
                  {{ form_widget(edit_form.address, { 'attr': {'class': 'form-control',} }) }} {{ form_errors(edit_form.address) }}
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-xs-12 col-md-3"&gt;
              {{ form(edit_form) }}
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Controller of listing page:</strong></p>
  
  <pre><code>public function indexAction($user)
  {
      $user = $this-&gt;container-&gt;get('security.token_storage')-&gt;getToken()-&gt;getUser();
      $em = $this-&gt;getDoctrine()-&gt;getManager();
  
      $findEntities = $em-&gt;getRepository('FLYBookingsBundle:Post')-&gt;findByBusId($user);
      $entities = $this-&gt;get('knp_paginator')-&gt;paginate($findEntities, $this-&gt;get('request')-&gt;query-&gt;get('page', 1), 5
      );
  
      return array(
          'entities' =&gt; $entities,
          'user' =&gt; $user,
      );
  
  }
  </code></pre>
  
  <p><strong>Edit controller:</strong></p>
  
  <pre><code>/**
   * Displays a form to edit an existing Post entity.
   *
   * @Route("/{id}/edit", name="post_edit")
   * @Method("GET")
   * @Template()
   */
  public function editAction($id)
  {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $user = $this-&gt;getUser();
      $this-&gt;getDoctrine()-&gt;getManager()-&gt;getRepository('FLYBookingsBundle:Post')-&gt;findBy(array('user' =&gt; $user));
      $entity = $em-&gt;getRepository('FLYBookingsBundle:Post')-&gt;find($id);
  
      if (!$entity) {
          throw $this-&gt;createNotFoundException('Unable to find Post entity.');
      }
  
  
      $editForm = $this-&gt;createEditForm($entity);
  
      return array(
          'entity' =&gt; $entity,
          'edit_form' =&gt; $editForm-&gt;createView(),
      );
  }
  </code></pre>