Controller/AuthController.php
public function loginAction(Request $request)
    {
        $session = $request->getSession();

        $form = $this->createFormBuilder()
            ->add('username', TextType::class, array('label' => 'Username'))
            ->add('password', PasswordType::class, array('label' => 'Password'))
            ->add('rememberMe', CheckboxType::class, array('label' => 'Remember Me', 'required' => false))
            ->getForm();

        $helper = $this->get('security.authentication_utils');
        if ($lastUsername = $helper->getLastUsername()) {
            $form->setData(array('username' => $lastUsername));
        }

        return array(
            'form' => $form->createView()
        );
    }
public function loginAction(Request $request)
    {
        $session = $request->getSession();

        $form = $this->createFormBuilder()
            ->add('username', TextType::class, array('label' => 'Username'))
            ->add('password', PasswordType::class, array('label' => 'Password'))
            ->add('rememberMe', CheckboxType::class, array('label' => 'Remember Me', 'required' => false))
            ->getForm();

        $helper = $this->get('security.authentication_utils');
        if ($lastUsername = $helper->getLastUsername()) {
            $form->setData(array('username' => $lastUsername));
        }

        return array(
            'form' => $form->createView()
        );
    }
public function loginAction ( Request $ request ) { $ session = $ request -> getSession ( ) ; $ form = $ this -> createFormBuilder ( ) -> add ( 'username' , TextType :: class , array ( 'label' => 'Username' ) ) -> add ( 'password' , PasswordType :: class , array ( 'label' => 'Password' ) ) -> add ( 'rememberMe' , CheckboxType :: class , array ( 'label' => 'Remember Me' , 'required' => false ) ) -> getForm ( ) ; $ helper = $ this -> get ( 'security.authentication_utils' ) ; if ( $ lastUsername = $ helper -> getLastUsername ( ) ) { $ form -> setData ( array ( 'username' => $ lastUsername ) ) ; } return array ( 'form' => $ form -> createView ( ) ) ; }
Displays a form to login

@Template
Displays a form to login