title: Validation in Symfony2 form not working
body: <p>i've created a form and when I send it to the server then I get an internal server error because there are empty fields which are not allowed. But i'm wondering because I check the form with the following code, so that normally the database actions should be skipped. What could be the reason?</p>
  
  <p>Controller:</p>
  
  <pre><code>public function newAction(Request $request) {
  
      $objTrip = new Trip();
      $objForm = $this-&gt;createForm(new TripType, $objTrip);
  
      if ($request-&gt;isMethod('POST')) {
          $objForm-&gt;bind($request);
  
          if ($objForm-&gt;isValid()) {
              $objEm = $this-&gt;getDoctrine()-&gt;getManager();
              $objEm-&gt;persist($objTrip);
              $objEm-&gt;flush();
  
              $response = new Response(json_encode(array('success' =&gt; true)));
              $response-&gt;headers-&gt;set('Content-Type', 'application/json');
              return $response;
          }
  
          // Es traten Fehler auf
          $arrErrors = array();
          foreach($objForm as $objField) {
  
              if($objField-&gt;hasErrors())
                  foreach($objField-&gt;getErrors() as $objError)
                      $arrErrors[] = array($objField-&gt;var['id'] =&gt; $objError-&gt;getMessage());
          }
          $response = new Response(json_encode(array('success' =&gt; false, 'errors' =&gt; $arrErrors)));
          $response-&gt;headers-&gt;set('Content-Type', 'application/json');
          return $response;
      }
  
      return array('form' =&gt; $objForm-&gt;createView());
  }
  </code></pre>
  
  <p>Entity:</p>
  
  <pre><code>/**
   * @ORM\Id
   * @ORM\Column(type="integer")
   * @ORM\GeneratedValue(strategy="AUTO")
   */
  protected $id;
  
  /**
   * @ORM\Column(type="string", length=100)
   * @Assert\MinLength(
   *     limit=3
   * )
   */
  protected $startLocation;
  
  /**
   * @ORM\Column(type="string", length=100)
   */
  protected $endLocation;
  
  /**
   * @ORM\Column(type="datetime")
   */
  protected $startTime;
  
  /**
   * @ORM\Column(type="decimal", scale=2)
   */
  protected $price;
  </code></pre>