Symfony2 form with field not in entity

Viewed 1587

this may be very easy but i'm new to symfony2, so i thought asking first. i'm creating a login form in a controller:

public function showAction()
{
    $admin = new Administrator();

$form = $this->createFormBuilder($admin)->setAction($this->generateUrl('admin_login_process'))
                 ->setMethod('POST')
                 ->add('username', 'text')
                 ->add('password', 'password')
                 ->add('remember', 'checkbox')
                 ->add('login', 'submit')
                 ->getForm();

    return $this->render('EraAdminBundle:Login:login.html.php', array('form'=>$form->createView()));
}

the username and password fields are part of the administrator entity, but the remember checkbox is not of course. how do i submit it together with the form? cause if i let it as it is i get this error:

Neither the property "remember" nor one of the methods "getRemember()", "isRemember()", "hasRemember()", "__get()" or "__call()" exist and have public access in class "Era\RestoranteBundle\Entity\Administrator".
1 Answers
Related