symfony - send in link id of username symfony2 -


want send email symfony2 application, email must contain link of confirmation , when user clicks on link state of field in db change.

i have in controller:

 $message = \swift_message::newinstance()                                     ->setsubject('demande de conge ')                                     ->setfrom($col->getemailcollaborateur())                                     ->setto($form->get("emailcdp")->getdata())                                     ->setbody($this->render('acmebundle:conge:demandecongenormal.html.twig', array('conge' => $conge, 'id'=> $this->getuser()->getid())))                                     ;                                     $this->get('mailer')->send($message); 

in twig :

id de collab: {{ id }} 

pour confirmer la demande :

{{ url('confirmer_conge' ,{'username': ' id '}) }}

but in email have :

  http://local.symfony2.com/app_dev.php/confirm/?username=+id+ 

i want id of user send message in controller update db

in routing.yml:

 confirmer_conge: pattern:  /confirm/{username} defaults: { _controller: acmebundle:conge:confirme } 

and in controller have function:

 public function confirmeaction() {return $this->render('acmebundle:conge:confirmer.html.twig'); } 

remove quotes around id, variable.

{{ url('confirmer_conge', {'username': id}) }} 

as accessing id in controller should work this:

public function confirmeaction($username)     //... } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -