2

I need your help please   When I send an email this error message is displayed: An exception has been thrown during the rendering of a template ("Parameter" notified for route "front_Succes" must match [^ /] ++ "(" given to generate a corresponding URL. "). (500 Internal Server Error)

this is my controller : `public function envoieAction($id, Request $request) {

    $em = $this->getDoctrine()->getManager();
    $Soumission = $em->getRepository('tutoBackofficeBundle:Soumission')->find($id);
    $Soumission->setEtat($em->getRepository("tutoBackofficeBundle:Etat")->findOneById('4'));



    $form = $this->createForm(new SoumissionType(), $Soumission);

    if ($request->getMethod() == 'POST') {
        $form->handleRequest($request);
        $users = $em->getRepository('tutoBackofficeBundle:User')->findAll();



        $lastId = $Soumission->getId();
        $soum = $em->find('tutoBackofficeBundle:Soumission', $lastId);

        $valide = $soum->getEtat();

        if ($valide->getId() == 4) {


            foreach ($soum->getEvaluateur() as $evlt) {
                $i = 0;
                $prof = array();
                foreach ($users as $user) {
                    $adresse = $evlt->getAdressemail();
                    $email = $user->getEmail();
                    if ($adresse == $email) {


                        $prof[] = $user;

                        foreach ($prof as $element) {

                            if ($element->getEtat()->getId() == 3) {

                                $notification = new \tuto\BackofficeBundle\Entity\Notification();

                                $notification->setSoumission($soum);
                                $notification->setEvaluationfinal();
                                $notification->setUser($element);
                                $notification->setDateNotif(new \DateTime());
                                $notification->setLu(false);
                                $em->persist($notification);
                                $i++;

just concentrate on this part//

$transport = \Swift_SmtpTransport::newInstance('smtp.gmail.com', 465, ' ssl')
                                                ->setUsername('a.b@gmail.com')->setPassword('abcd');

`

                                $mailer = \Swift_Mailer::newInstance($transport);
                                $message = \Swift_Message::newInstance()
                                        ->setSubject('Vous Avez un nouveau papier à évaluer')
                                        ->setFrom('yahia1.sarra2@gmail.com')
                                        ->setTo($adresse)

                                        ->setBody($this->renderView('tutoBackofficeBundle:Soumission:email2.html.twig', array('soumission' => $soum, 'evlt' => $evlt, 'notifId' => $notification)))
                                ;

                                $this->get('mailer')->send($message);



                                $em->persist($Soumission);
                                $em->flush();
                                $this->addFlash("success", "le papier a été envoyé avec succés");
                            }
                        }
                        return $this->redirectToRoute('tuto_soumission');
                        //$message="un Etat est modifié";
                    }
                }
            }
        }
    }
    return $this->render('tutoBackofficeBundle:Soumission:modif.html.twig', array(
                'form' => $form->createView(),
                    )
    );
}`

`

this is my twig :

 {%if evlt.civilite=='Mme' %}Chère {%else%}Cher {%endif%}Professeur «{{evlt.nom}}»

Nous avons le plaisir de vous informer que le 16ème Colloque International de l’ATM se tiendra les 07 et 08 avril 2018 à Hammamet, en Tunisie.En tant que Président du Comité Scientifique et afin de garantir le succès de cette 16ème édition du colloque, nous vous sollicitons de bien vouloir évaluer le papier intitulé «{{soumission.titrePapier}}» avant le 15 février 2018 et ce en cliquant sur le lien suivant : {{url('front_Succes',{'id':soumission.id,'notifId':notifId.id})}} // the problem here Pour vous simplifier la tâche, nous vous prions de bien vouloir utiliser la fiche d’évaluation en cliquant sur le lien suivant : {{url('front_questionnaire',{'soumission':soumission.id})}} Comptant également sur votre présence les jours du colloque, nous vous remercions, {%if evlt.civilite=='Mme' %}Chère {%else%}Cher {%endif%} collègue, pour votre précieuse collaboration. Bien Cordialement. Président du Comité d'Evaluation de l’ATM

this is the routing

front_Succes:
path: /soumission_succes/{id}/{notifId}
defaults: {_controller: tutoFrontofficeBundle:Soumission:affiche }

this is the function affiche:

public function afficheAction(\tuto\BackofficeBundle\Entity\Soumission $id, \tuto\BackofficeBundle\Entity\Notification $notifId) {
    $em = $this->getDoctrine()->getManager();
    $notification = $em->getRepository('tutoBackofficeBundle:Notification')->findBy(array('soumission' => $id, 'user' => $this->getUser()));
    $notif = $em->find("tutoBackofficeBundle:Notification", $notifId);

    $notif->setLu(true);
    $em->persist($notif);
    $em->flush();
    return $this->render('tutoFrontofficeBundle:Soumission:affiche.html.twig', array('notification' => $notification));
}
Sihem Sahnoun
  • 21
  • 1
  • 3

1 Answers1

0

I think this is just a typo in your code. You are using a "(" instead of your notifId parameter.

Hugo Soltys
  • 227
  • 1
  • 11