史京迪
史京迪

Reputation: 481

Call controller/action in event listener

I want to run a process in background when user login. So I create a process in a login listener.

Here is my code.

public function onLogin(InteractiveLoginEvent $event)
    {
      $user = $event->getAuthenticationToken()->getUser();

      if($user)
      {
        $userid= $user->getId();
        echo $userid;
        $process = new Process('php d:wamp/www/jobologic/app/console JJJJ:RRRR'." ".$userid); 
        $process->start();

      }
    }

after the process start in background. I want user see the homepage of the website. What should I do after the $process->start()function?

Upvotes: 2

Views: 626

Answers (1)

Jakub Zalas
Jakub Zalas

Reputation: 36191

If you're using a form login, you could configure a default target path and force it with the following configuration:

firewalls:
    myfirewall:
        # ...
        form_login:
            # ...
            always_use_default_target_path: true
            default_target_path:            /

Configuration reference: http://symfony.com/doc/current/reference/configuration/security.html

Upvotes: 3

Related Questions