title: Validate a number field in symfony2
body: <p>I have the following situation:
  In my FormType class:</p>
  
  <pre><code>... 
  $builder-&gt;add('fieldToValidate', 'number', array('required' =&gt; false))
  ...
  </code></pre>
  
  <p>In the model class:</p>
  
  <pre><code>...
  use Symfony\Component\Validator\Constraints as Assert;
  ...
  /**
   * @var float $fieldToValidate
   *
   * @ORM\Column(name="fieldToValidate", type="float", nullable=true)
   * @Assert\Type(type="float", message="Must be a number.")
   */
  private $fieldToValidate;
  </code></pre>
  
  <p>In the action in controller:</p>
  
  <pre><code>$entity = $this-&gt;getService('my_service')-&gt;findMyEntity($entityId);
  $editForm = $this-&gt;createForm(new MyEntityType(), $entity, $myOptions);
  $request = $this-&gt;getRequest();
  $editForm-&gt;bindRequest($request);
  if ($editForm-&gt;isValid()){
  </code></pre>
  
  <p>When i submit the form with some invalid data in fieldToValidate (e.g. "foo") a got a exception:
  <code>Expected argument of type "numeric", "boolean" given</code>
  Debugging my code in controller i note it raise the excepction in line 
  <code>$editForm-&gt;bindRequest($request);</code>
  How can i make to use the <code>$editForm-&gt;isValid()</code> to control the exception. 
  Is not for this i validate in model and form?</p>