How redirect in onSecurityInteractiveLogin method in LoginListener - Symfony2 How redirect in onSecurityInteractiveLogin method in LoginListener - Symfony2 symfony symfony

How redirect in onSecurityInteractiveLogin method in LoginListener - Symfony2


Use a handler instead of an event listener if you need to change the response. More information here: http://www.reecefowell.com/2011/10/26/redirecting-on-loginlogout-in-symfony2-using-loginhandlers/


I found the UrlGeneratorInterface used in FOSUserBundle

FosUserBundle Hooking into controllers

use Symfony\Component\Routing\Generator\UrlGeneratorInterface;...public function __construct(UrlGeneratorInterface $router){    $this->router = $router;}......$url = $this->router->generate('homepage');