title: How can I clear form values after successful form submission
body: <p>How can I clear form values after successful form submission?</p>
  
  <p>These didn't help:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/15014747/how-to-clear-field-value-with-symfony2-forms">How to clear field value with Symfony2 forms</a></li>
  <li><a href="http://forum.symfony-project.org/viewtopic.php?t=26868&amp;p=97772" rel="noreferrer">Clear form values after successful submit</a></li>
  </ul>
  
  <p><strong>CONTROLLER:</strong></p>
  
  <pre><code>namespace Car\BrandBundle\Controller;
  
  use Car\BrandBundle\Entity\BrandEntity;
  use Car\BrandBundle\Form\Type\BrandType;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
  
  class BrandController extends Controller
  {
      public function indexAction()
      {
          $form = $this-&gt;getFrom();
  
          return $this-&gt;render('CarBrandBundle:Default:brand.html.twig',
                  array('page' =&gt; 'Brand', 'form' =&gt; $form-&gt;createView(), 'brands' =&gt; $this-&gt;getBrands()));
      }
  
      public function createAction(Request $request)
      {
          if ($request-&gt;getMethod() != 'POST')
          {
              return new Response('Only POST method is allowed');
          }
  
          $form = $this-&gt;getFrom();
  
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isValid())
          {
              $submission = $form-&gt;getData();
  
              $em = $this-&gt;getDoctrine()-&gt;getManager();
  
              $brand = new BrandEntity();
              $brand-&gt;setName($submission-&gt;getName());
  
              $em-&gt;persist($brand);
              $em-&gt;flush();
  
              $this-&gt;redirect($this-&gt;generateUrl('brand'));
          }
  
          return $this-&gt;render('CarBrandBundle:Default:brand.html.twig',
                  array('page' =&gt; 'Brand', 'form' =&gt; $form-&gt;createView(), 'brands' =&gt; $this-&gt;getBrands()));
      }
  
      private function getFrom()
      {
          return $this-&gt;createForm(new BrandType(), new BrandEntity(),
                  array('action' =&gt; $this-&gt;generateUrl('brandCreate')));
      }
  
      private function getBrands()
      {
          $repo = $this-&gt;getDoctrine()-&gt;getRepository('CarBrandBundle:BrandEntity');
          $brands = $repo-&gt;findAll();
  
          return $brands;
      }
  } 
  </code></pre>