title: How to get entity at the controller in symfony2
body: <p>I have a Product entity and want display a list of products (from database) on page and after that get selected entity in controller.</p>
  
  <p>ProductsType:</p>
  
  <pre><code>class ProductsType extends AbstractType
  {
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
  
      }
  
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder-&gt;add('products', 'entity', array(
                  'class' =&gt; 'MyBundle:Product',
                  'property' =&gt; 'description',
                  'label' =&gt; false,
                  'query_builder' =&gt; function(EntityRepository $er) {
                      return $er-&gt;createQueryBuilder('u')
                          -&gt;orderBy('u.description', 'DESC');
                  },
              ));
      }
  
      public function getName()
      {
          return 'products';
      }
  }
  </code></pre>
  
  <p>Twig template:</p>
  
  <pre><code>&lt;form action="{{ path('mgmt_product_update', { 'id': product.id }) }}" method="post" {{ form_enctype(form) }}&gt;
      &lt;strong&gt;Product:&lt;/strong&gt;{{ form_widget(form.products) }}
      &lt;button value="update" name="update"&gt;Update&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>...
  public function productUpdateAction() // ?
  ...
  </code></pre>
  
  <p>How i can get selected product in productUpdateAction() ?
  Maybe I'm doing it all wrong and this is not the best solution?</p>