Bonjour à tous.
voici mes code html.twig
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 <form action="{{ path("_LaLingerie_accueil") }}" method="post" {{ form_enctype(form) }}> {# Les erreurs générales du formulaire. #} {{ form_errors(form) }} {# Idem pour un autre champ. #} <div> {{ form_label(form.speudo, 'speudo') }} {{ form_errors(form.speudo) }} {{ form_widget(form.speudo) }} </div> <div> {{ form_label(form.adresseemail, 'email') }} {{ form_errors(form.speudo) }} {{ form_widget(form.speudo) }} </div> <div> {{ form_label(form.password, 'mot de pazsse') }} {{ form_errors(form.password) }} {{ form_widget(form.password) }} </div> <input type="submit" /> {{ form_end(form) }} </form>voici les route
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 <form action="{{ path("_LaLingerie_homepage") }}" method="post" {{ form_enctype(form) }}> {# Les erreurs générales du formulaire. #} {{ form_errors(form) }} {# Idem pour un autre champ. #} <div> {{ form_label(form.contenu, "Contenu de l'article") }} {{ form_errors(form.contenu) }} {{ form_widget(form.contenu) }} </div> <div> {{ form_label(form.datecreationcommentaire, 'date') }} {{ form_errors(form.datecreationcommentaire) }} {{ form_widget(form.datecreationcommentaire) }} </div> <input type="submit" /> {{ form_end(form) }} </form>
mon controleur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 _LaLingerie_homepage ANY ANY ANY / _LaLingerie_accueil ANY ANY ANY /
Merci pour vos attention.
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 class DefaultController extends Controller { public function indexAction() { $commentaire = new Commentaire(); $form = $this->createForm(new CommentaireType(), $commentaire); $request = $this->get('request'); if ($request->getMethod() == 'POST') { $form->bind($request); if( $form->isValid() ) { $em = $this->getDoctrine()->getManager(); $em->persist($commentaire); $em->flush(); return $this->redirect($this->generateUrl('_LaLingerie_accueil')); } } return $this->render('LaLingerieBundle:Default:index.html.twig',array( 'form' => $form->createView())); } public function accueilAction() { $commentateur = new Commentateur(); $form = $this->createForm(new CommentaireType(), $commentateur); $request = $this->get('request'); if ($request->getMethod() == 'POST') { $form->bind($request); if( $form->isValid() ) { $em = $this->getDoctrine()->getManager(); $em->persist($commentateur); $em->flush(); return $this->redirect($this->generateUrl('_LaLingerie_accueil')); } } return $this->render('LaLingerieBundle:Default:index.html.twig',array( 'form2' => $form->createView())); }
Partager