It can be very easy, but I'm new to symfony2, so I thought it first when asking. I create a login form for the 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()));
}
Username and password fields are part of the admin object, but the checkbox is optional. How can I submit it along with the form? because if I do this, 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".
source
share