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
Post a Comment