title: Symfony2 parameter with embedded forms
body: <p><strong>EDIT :</strong> I find the real problem!</p>
  <p>I am trying to give a paramEter to a sub-form from the controller. Without this parameter, the form is working perfectly.</p>
  <p>I want to show in the select list only users which are not already present in the relation. I have this query_builder:</p>
  <pre><code>'query_builder' =&gt; function(UserRepository $er) use($options) {
                                      return $er-&gt;getFormateursAvailable($options['categ']);
                                 },
  </code></pre>
  <p>And the method:</p>
  <pre><code>public function setDefaultOptions(OptionsResolverInterface  $resolver)
  {
      $resolver-&gt;setDefaults(array('data_class' =&gt; 'Intranet\FormationBundle\Entity\CategorieFormateur', 'categ' =&gt; false));
      //$resolver-&gt;setDefaults(array('data_class' =&gt; 'Intranet\FormationBundle\Entity\CategorieFormateur'));
  }
  </code></pre>
  <p>For the collection form, so, I have to put this option in the form:</p>
  <pre><code>'options' =&gt; $options,
  </code></pre>
  <p>But I don't know if it is true, and I have to define the method:</p>
  <pre><code>public function setDefaultOptions(OptionsResolverInterface  $resolver)
  {
      $resolver-&gt;setDefaults(array('categ' =&gt; false));
  }
  </code></pre>
  <p>(The form is working without this method if there is no parameter.)
  And calling:</p>
  <pre><code>$form = $this-&gt;createForm(new GererFormateurCategorieType(), $categorie, array('categ' =&gt; $categorie));
  </code></pre>
  <p>And then, I have this error:</p>
  <blockquote>
  <p>Neither the property &quot;user&quot; nor one of the methods &quot;getUser()&quot;, &quot;isUser()&quot;, &quot;hasUser()&quot;, &quot;__get()&quot; exist and have public access in class &quot;Intranet\FormationBundle\Entity\Categorie&quot;.</p>
  </blockquote>
  <p>The relation:</p>
  <p>Categorie has this property:</p>
  <pre><code>/**
  * @ORM\OneToMany(targetEntity=&quot;Intranet\FormationBundle\Entity\CategorieFormateur&quot;, mappedBy=&quot;categorie&quot;, cascade={&quot;persist&quot;, &quot;remove&quot;}, orphanRemoval=true)
  **/
  private $formateurs;
  </code></pre>
  <p>With addFormateur, removeFormateur and getFormateurs</p>
  <p>CategorieFormateur :</p>
  <pre><code>    /**
  * @ORM\Id
  * @ORM\ManyToOne(targetEntity=&quot;Intranet\FormationBundle\Entity\Categorie&quot;, inversedBy=&quot;formateurs&quot;)
  * @ORM\JoinColumn(name=&quot;categorie_id&quot;, referencedColumnName=&quot;id&quot;)
  */
  private $categorie;
  
  /**
  * @ORM\Id
  * @ORM\ManyToOne(targetEntity=&quot;Intranet\UserBundle\Entity\User&quot;)
  * @ORM\JoinColumn(name=&quot;user_id&quot;, referencedColumnName=&quot;id&quot;)
  */
  private $user;
  </code></pre>
  <p>with setters and getters for each properties.</p>