2014-06-20 79 views

回答

1

像這樣:

$token = new UsernamePasswordToken($user, '12345', "admin", $user->getRolesAsArray()); 
$this->get('security.context')->setToken($token); 

$event = new InteractiveLoginEvent($request, $token); 
$this->get("event_dispatcher")->dispatch("security.interactive_login", $event); 
+0

謝謝。什麼是「InteractiveLoginEvent」?登錄事件需要 – Mohebifar

+1

,這可以確保登錄事件的所有事件偵聽器都是tirggerd – Rufinus