symfony - FosUser, redirect after registration -


so, i'm trying change redirection url after registration fos.

so, have create custom registrationconfirmlistener :

<?php namespace project\applicationbundle\eventlistener;  use fos\userbundle\fosuserevents; use fos\userbundle\event\userevent; use symfony\component\eventdispatcher\eventsubscriberinterface; use symfony\component\httpfoundation\redirectresponse; use symfony\component\routing\generator\urlgeneratorinterface;  /**  * listener responsible change redirection @ end of password resetting  */ class registrationconfirmlistener implements eventsubscriberinterface {     private $router;      public function __construct(urlgeneratorinterface $router)     {         $this->router = $router;     }      /**      * {@inheritdoc}      */     public static function getsubscribedevents()     {         return array(                 fosuserevents::registration_confirm => 'onregistrationconfirm'         );     }      public function onregistrationconfirm(getresponseuserevent $event)     {         $url = $this->router->generate('myurlforredirect');          $event->setresponse(new redirectresponse($url));     } } 

and add these lines services.yml :

rs_user.registration_complet:         class: thankswho\applicationbundle\eventlistener\registrationconfirmlistener         arguments: [@router]         tags:             - { name: kernel.event_subscriber } 

but when test, i'm redirected /confirmed , not myurlforredirect

any ideas ?

i think omitted import getresponseuserevent class in listener. should replace use fos\userbundle\event\userevent; use fos\userbundle\event\getresponseuserevent;


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -