title: Symfony2 - Entity form type query_builder
body: <p>I'm going to recover seminaire entity in InscritSeminaireType:</p>
  
  <pre class="lang-php prettyprint-override"><code>class InscritSeminType extends AbstractType {
  
      public function buildForm(FormBuilderInterface $builder, array $options) {
  
          $builder
              //-&gt;add('dateInscrit')
              -&gt;add('seminaire','entity', array(
                  'class' =&gt; 'EspritSeminaireBundle:Seminaire',
                  'query_builder' =&gt; function($repository)use ($id) {
                      return $repository-&gt;getSeminaireLibre('id')
                          -&gt;setParameter('id', $id)
                      ;
                  },                          
                  'required' =&gt; false,            
               ))
          //-&gt;add('etudiant')
          ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver) {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'Esprit\SeminaireBundle\Entity\InscritSemin',
  
          ));
      }
  
      public function getName() {
          return 'esprit_seminairebundle_inscritsemintype';
      }
  }
  </code></pre>
  
  <p>but it return an error: </p>
  
  <blockquote>
    <p>Notice: Undefined variable: id in C:\wamp\www\PFE\EOL\src\Esprit\SeminaireBundle\Form\InscritSeminType.php line 22 </p>
  </blockquote>
  
  <p>So could anybody tell me how can I fix this?</p>