bonjour a tous,

voilà j'ai un problème, je souhaite créer un formulaire de connexion pour mon projet, mais voilà, il me retourne cette erreur et je ne sais pas la débuguer.

je suis sur symfony 3.14.

voici l'erreur: Attempted to call an undefined method named "createView" of class "Symfony\Component\Form\FormBuilder".

et voici mon controller sachant que le formulaire d'inscription fonctionne.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
 
namespace App\Controller;
 
use App\Entity\User;
use App\Form\UserType;
 
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
 
/**
 * Class InscriptionController
 * @package App\Controller
 * @Route("/inscription")
 */
class InscriptionController extends Controller
{
    /**
     * @Route("/", name="inscription_index")
     */
    public function index(Request $request)
    {
        $user = new User();
        $form = $this->createForm(UserType::class, $user);
        $form->add('ajouter', SubmitType::class, ["label"=>"Ajouter"]);
 
        $form->handleRequest($request);
 
        if ($form->isSubmitted() && $form->isValid())
        {
            $user = $form->getData();
 
            $em = $this->getDoctrine()->getManager();
            $em->persist($user);
            $em->flush();
 
            $this->addFlash("succes", "Vous vous êtes inscrit sur ce site");
 
            return $this->redirectToRoute('accueil_index');
        }
        return $this->render('inscription/index.html.twig', [
            'formView' => $form->createView(),
        ]);
    }
    /**
     * @Route("/connexion", name="inscription_connexion")
     */
    public function connexion(AuthenticationUtils $authenticationUtils)
    {
        $error = $authenticationUtils->getLastAuthenticationError();
 
        $form = $this->createFormBuilder();
        $form->setAction($this->generateUrl('authentification_check'));
        $form->add("login", TextType::class, ['label'=> "Identifiant: ", 'required' =>'false' ]);
        $form->add("password", PasswordType::class, ['label'=> "Mot de passe: ", 'required' =>'false']);
        $form ->add('valider', SubmitType::class, ['label'=> "S'identifier: "]);
        $form->getForm();
 
 
        return $this->render('inscription/connexion.html.twig', [
            'form' => $form->createView(),
            'error' => $error
        ]);
 
    }
    /**
     * @Route("/check", name="authentification_check")
     */
    public function check()
    {
        return new Response();
    }
 
 
    /**
     * @Route("/logout", name="authentification_logout")
     */
    public function logout()
    {
        return new Response();
    }
}

Alors si vous pouviez m'aider se serait sympa