This magic must happen in your Controller and you have to use two things:
You've got to call $form->handleRequest($request)
You also need to persist your entity with $em->persist($entity)->flush()
Here is an example based on your code. This is the part of the controller when you handle your form:
class YourController extends Controller
{
public function executeAction($request)
{
$entity = new Comment;
$form = $this->createForm(new CommentType(), $entity);
$form->handleRequest($request);
if ($form->isValid())
{
$em = $this->getDoctrine()->getManager(); // this is where it begins
$em->persist($entity); // it goes on
$em->flush(); // done!
return $this->redirect($this->generateUrl('your_next_url'));
}
return $this->render('YourBundle:YourDirectory:template.html.twig', array(
'form' => $form->createView(),
));
}
}