title: How can I save my form data into the database
body: <p>I recently started using Symfony2 to make an easy Web App. The main functions are saving/getting data from a Data Base using forms let me add the code of the FormType and the Controller:</p>
  
  <pre><code>&lt;?php
  class RegistroController extends Controller{
  
      public function registrofamAction(){
          $peticion = $this-&gt;get('request');
          $em = $this-&gt;get('doctrine')-&gt;getEntityManager();
  
          $familia = new Familia();
  
          $familia-&gt;setRol($rol='fam');
  
          $form = $this-&gt;get('form.factory')-&gt;create(
                  new FamiliaType(),
                  array()
                  );
  
  
          $form-&gt;setData($familia);
  
          if ($peticion-&gt;getMethod() == 'POST') {
              $form-&gt;bind($peticion);
  
  
              if ($form-&gt;isValid()) {
  
                  $familia-&gt;setProgenitor1($Nombrep1);
  
                  $em-&gt;persist($familia);
                  $em-&gt;flush();
              }
          }
  
          return $this-&gt;render('PreditBundle:Default:registro.html.twig', array('form' =&gt; $form-&gt;createView()));
      }
  
  
  
  
  }
  ?&gt;
  </code></pre>
  
  <p>I know it would be easy but I don't have clear how the form is returned to you. Is the form in the <code>$peticion</code>? how can i manage the form info and the database?</p>
  
  <p>Thanks for all! </p>