render('index.html.twig', [ 'loginForm' => $this->createLoginForm('')->createView(), ]); } private function createLoginForm(string $username): FormInterface { $form = $this->createForm(LoginType::class, null, [ 'action' => $this->generateUrl('user_login'), ]); $form->get('_username')->setData($username); $form->add('submit', SubmitType::class); return $form; } }