I am using a login form on Symfony2 with the following controller code
public function loginAction(Request $request)
{
$user = new SiteUser();
$form
In Symfony >= 2.3, you can get the value of single fields with:
$var = $form->get('yourformfieldname')->getData();
On the other hand, you can use:
$data = $form->getData();
BUT this would get you two different things:
the entity with values populated by the form, if your form have the data-class
option enabled (so it's binded to an entity); this will exclude any field with the 'mapping' => false
option
otherwise, an array with all the form's fields