Bonjour,
Je rencontre un petit souci depuis ce matin. J'ai une vue twig, à laquelle je fais passer deux paramètres que je récupère ensuite dans un controlleur PHP, tel que :
Vue twig (c'est donc au niveau du href que j'ai mon soucis)
Controlleur associé qui récupère mes deux variables :
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 {% extends 'layout.html.twig' %} {% block body %} <h1>Récapitulatif de votre commande : </h1> <div id = 'bodyRecap'> <div id = 'infosClients'> <h2>Informations client</h2> {% for panier in basket %} <h3>Date de réservation : <br /><strong>{{ panier.date|date('d-m-Y') }}</strong></h3> <h3>Mail : <br /><strong>{{ panier.mail }}</strong></h3><br/> {% endfor %} </div> <div id = 'recap'> <table> {% for billet in billets %} <tr> <td><h3>Billet n° {{ loop.index }} : </h3></td> <td><h3><strong>{{ billet.name }}</strong></h3></td> <td><h3><strong>{{ billet.firstname }}</strong></h3></td> <td><h3><strong>{{ billet.price }} </strong></h3></td> </tr> <br /> {% endfor %} </table> </div> <div id = 'priceBasket'> <h2 id = 'titreTotal'>Total : </h2> {% for panier in basket %} <h3>Total HT : <strong>{{ panier.totalPrice }} </strong></h3> <h3>TVA à 20% : <strong>{{ panier.totalTVA }} </strong></h3> <h3>Total TTC : <strong>{{ panier.totalTTC }} </strong></h3> <a href = "{{ path('paiement', {'totalTTC': panier.totalTTC, 'mail': panier.mail}) }}">Procéder au paiement</a> {% endfor %} </div> </div> {% endblock %}
Et voici l'erreur que je rencontre :
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 namespace AppBundle\Controller\Paiement; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class PaiementController extends Controller { /** * @Route("/paiement", name="paiement") * * @param int $tarifTTC * @param string $mail */ public function paiementAction($tarifTTC, $mail) { dump($tarifTTC); dump($mail);exit; } }
Mes deux variables passées me rendent bien des valeurs int et string, comme précisé dans mon annotation, le routing a donc l'air de bien se passer, mais je ne comprends pas pourquoi j'ai ce message d'erreur. J'ai bien des valeurs qui remontent, elles s'affichent correctement sur ma vue Twig.Controller "AppBundle\Controller\Paiement\PaiementController::paiementAction()" requires that you provide a value for the "$tarifTTC" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.
Toute idée est la bienvenue !![]()
Partager