title: Symfony2: Passing options to buildForm
body: <p>So I'm pretty new to Symfony and I'm trying to have the controller build slightly different forms based on controller actions. Right now, I have this</p>
  
  <pre><code>//in Controller
  
  public function addLocationEntryAction(Request $request)
  {
      $entry = new Entry();
      $form = $this-&gt;get('form.factory')-&gt;create(new EntryType('addLocation'), $entry);
  
      return $this-&gt;render('OOTNBlogBundle:Blog:addEntry.html.twig', array(
          'form' =&gt; $form-&gt;createView()
      ));
  }
  
  public function addArticleEntryAction(Request $request)
  {
      $entry = new Entry();
      $form = $this-&gt;get('form.factory')-&gt;create(new EntryType('addArticle'), $entry);
  
      return $this-&gt;render('OOTNBlogBundle:Blog:addEntry.html.twig', array(
          'form' =&gt; $form-&gt;createView()
      ));
  }
  </code></pre>
  
  <p>And </p>
  
  <pre><code>//in EntryType
  
  public function buildForm(FormBuilderInterface $builder, array $options)
  {
  
      $builder
          -&gt;add('title',      'text')
          -&gt;add('continent',  'text', array('required' =&gt; false))
          -&gt;add('country',    'text', array('required' =&gt; false))
          -&gt;add('category',   'text', array('required' =&gt; false))
          -&gt;add('author',     'hidden')
          -&gt;add('type',       'hidden')
          -&gt;add('text',       'textarea')
          -&gt;add('post',       'submit')
      ;
  }
  </code></pre>
  
  <p>I'd like to pass an option from the controller in <code>buildForm</code>, so that I can do something like this:</p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options, $option)
  {
      $builder
          -&gt;add('title',      'text')
      ;
  
      if($option == 'addLocation')
      {
          $builder
              -&gt;add('continent',  'text', array('required' =&gt; false))
              -&gt;add('country',    'text', array('required' =&gt; false))
          ;
      }
      elseif($option == 'addArticle')
      {
          $builder
              -&gt;add('category',   'text', array('required' =&gt; false))
          ;
      }
  
      $builder
          -&gt;add('author',     'hidden')
          -&gt;add('type',       'hidden')
          -&gt;add('text',       'textarea')
          -&gt;add('post',       'submit')
      ;
  }
  </code></pre>
  
  <p>How do I do this? I've checked out the Symfony doc and similar questions on here but nothing seems to be quite fitting for my case. I don't know.</p>