title: How can I get ID of entity in form type?
body: <p>I have form type for build form of category:</p>
  
  <pre><code>class CategoryType extends AbstractType
  {
      /**
       * @param FormBuilderInterface $builder
       * @param array $options
       */
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
                  -&gt;add('published', 'checkbox', array(
                      'required' =&gt; FALSE,
                  ))
                  -&gt;add('parent', 'entity', array(
                      'class' =&gt; 'BWBlogBundle:Category',
                      'property' =&gt; 'name',
                      'query_builder' =&gt; function(EntityRepository $er) {
                          return $er-&gt;createQueryBuilder('c')
                                  -&gt;where('c.id != :id')
                                  -&gt;setParameter('id', ... /* I need to get category ID here */)
                              ;
                      },
                      'required' =&gt; FALSE,
                      'empty_value' =&gt; 'Корневая категория',
                  ))
              // other my code
  </code></pre>
  
  <p>How can I get category ID of entity in <code>query_builder</code> closure in <code>buildForm</code> action?</p>