To accomplish what you want, you should use FOSUserEvents::REGISTRATION_CONFIRM
instead of FOSUserEvents::REGISTRATION_CONFIRMED
.
You then have to rewrite rewrite your class RegistrationConfirmedListener
like:
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('rsWelcomeBundle_check_full_register');
$event->setResponse(new RedirectResponse($url));
}
}
And your service.yml
:
services:
rs_user.registration_complet:
class: rs\UserBundle\EventListener\RegistrationConfirmListener
arguments: [@router]
tags:
- { name: kernel.event_subscriber }
REGISTRATION_CONFIRM
receives a FOS\UserBundle\Event\GetResponseUserEvent
instance as you can see here: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/FOSUserEvents.php
It allows you to modify the response that will be sent: https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Event/GetResponseUserEvent.php