title: Symfony 2 - Checkbox with default Value unless Data From Database
body: <p>I have a check box that Renders correctly . If there is no data from the database I want the check box to be checked by default.</p>
  
  <p>If I set <code>"data" = True</code> it displays the checkbox checked. Now if I get the data from the database it won't override the checkbox to the boolean value of false. If I remove the data" => true then I am able to get the correct checkbox from the database but I am not able to set the default checkbox. </p>
  
  <pre><code>    public function buildForm(FormBuilderInterface $builder, array $options)
  {
  
      $builder
          -&gt;add('isFieldFirstname', 'checkbox', array(
          'label'    =&gt; 'Show First Name',
          'required' =&gt; false,
              "data" =&gt; true,
              )
                  )
  </code></pre>
  
  <p>Just to recap </p>
  
  <ol>
  <li>Database - No record found - show default checkbox as checked </li>
  <li>If record found use value from database ex isFieldFirstname = false checkbox unchecked</li>
  </ol>