title: Symfony2 form unchecked checkbox not taken into account, why?
body: <p><strong>When I send a form with an <em>unchecked</em> checkbox, if the related entity property equals <code>true</code>, then it does not change to <code>false</code>.</strong></p>
  
  <p>The other way round (setting property to true when the form is sent with a checked checkbox) works fine, as well as all the forms other fields saving.</p>
  
  <p>Here is how I build the form and declare the related property:</p>
  
  <pre><code>// --- Form creation function EntityType::buildForm() ---
  $builder-&gt;add('secret', 'checkbox', array( 'required' =&gt; false ));
  
  // --- Entity related property, Entity.php file ---
  /** @ORM\Column(name="secret", type="boolean") */
  protected $secret;
  </code></pre>
  
  <hr>
  
  <p>EDIT: <em>The issue happens because the form is submitted using <strong>a PATCH request</strong>.</em></p>
  
  <p>In Symfony, the <code>Form::submit</code> method is called by a Request Handler with this line:</p>
  
  <pre><code>$form-&gt;submit($data, 'PATCH' !== $method);
  </code></pre>
  
  <p><em>As a result the <code>Form::submit</code> <code>$clearMissing</code> parameter is set to <code>false</code> in the case of a PATCH request, thus leaving the non-sent fields to their old value.</em></p>
  
  <p><em>But I do not know how to solve the problem. If I explicitely pass a JSON <code>{secret: false}</code> to the Symfony framework when the checkbox is not checked, it will interpret it as the <code>"false"</code> string and consider that a true value, thus considering the checkbox checked...</em></p>
  
  <hr>
  
  <p>NB. I have exactly the same issue <strong>with an array of checkboxes using a <code>choice</code> field type</strong> (with <code>multiple</code> and <code>extended</code> to <code>true</code>) linked to a Doctrine Simple Array property: as soon as a given checkbox has been sent once as checked, it is impossible to set back the related property to <code>false</code> with subsequent <code>unchecked</code> submissions.</p>