title: How to change form field value in symfony 2
body: <p>I have a form like below:</p>
  
  <pre class="lang-php prettyprint-override"><code>class ItemType extends AbstractType
  {
      public function buildForm(FormBuilderInterface $builder, array $options)
      {
          $builder
              // ...
              -&gt;add('tags','text',array(
                  'required' =&gt; false,
                  'attr' =&gt; array('name' =&gt; 'tags'),
                  'mapped' =&gt; false))
          ;
      }
  
      public function setDefaultOptions(OptionsResolverInterface $resolver)
      {
          $resolver-&gt;setDefaults(array(
              'data_class' =&gt; 'MyBundle\ItemBundle\Entity\Item',
              'cascade_validation' =&gt; true,
          ));
      }
  }
  </code></pre>
  
  <p>My edit action</p>
  
  <pre class="lang-php prettyprint-override"><code>public function editAction(Request $request, $id) {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
      $entity = $em-&gt;getRepository('MyBundleItemBundle:Item')-&gt;find($id);
      $form = $this-&gt;createForm(new ItemType(), $entity);
      //$form-&gt;get('tags')-&gt;setValue('test text');
      // ^- this is what i would like to do -^
      // ...
  }
  </code></pre>
  
  <p>While I am editing an item, How can I change form field value inside controller before rendering it?</p>