12
12
namespace FOS \UserBundle \EventListener ;
13
13
14
14
use FOS \UserBundle \FOSUserEvents ;
15
- use FOS \ UserBundle \ Event \ FormEvent ;
15
+ use Symfony \ Component \ EventDispatcher \ Event ;
16
16
use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
17
17
use Symfony \Component \HttpFoundation \Session \SessionInterface ;
18
18
use Symfony \Component \Translation \TranslatorInterface ;
19
19
20
20
class FlashListener implements EventSubscriberInterface
21
21
{
22
22
private static $ successMessages = array (
23
- FOSUserEvents::CHANGE_PASSWORD_SUCCESS => 'change_password.flash.updated ' ,
24
- FOSUserEvents::GROUP_CREATE_SUCCESS => 'group.flash.created ' ,
23
+ FOSUserEvents::CHANGE_PASSWORD_COMPLETED => 'change_password.flash.updated ' ,
24
+ FOSUserEvents::GROUP_CREATE_COMPLETED => 'group.flash.created ' ,
25
25
FOSUserEvents::GROUP_DELETE_COMPLETED => 'group.flash.deleted ' ,
26
- FOSUserEvents::GROUP_EDIT_SUCCESS => 'group.flash.updated ' ,
27
- FOSUserEvents::PROFILE_EDIT_SUCCESS => 'profile.flash.updated ' ,
28
- FOSUserEvents::REGISTRATION_SUCCESS => 'registration.flash.user_created ' ,
29
- FOSUserEvents::RESETTING_RESET_SUCCESS => 'resetting.flash.success ' ,
26
+ FOSUserEvents::GROUP_EDIT_COMPLETED => 'group.flash.updated ' ,
27
+ FOSUserEvents::PROFILE_EDIT_COMPLETED => 'profile.flash.updated ' ,
28
+ FOSUserEvents::REGISTRATION_COMPLETED => 'registration.flash.user_created ' ,
29
+ FOSUserEvents::RESETTING_RESET_COMPLETED => 'resetting.flash.success ' ,
30
30
);
31
31
32
32
/**
@@ -44,17 +44,17 @@ public function __construct(SessionInterface $session, TranslatorInterface $tran
44
44
public static function getSubscribedEvents ()
45
45
{
46
46
return array (
47
- FOSUserEvents::CHANGE_PASSWORD_SUCCESS => 'addSuccessFlash ' ,
48
- FOSUserEvents::GROUP_CREATE_SUCCESS => 'addSuccessFlash ' ,
47
+ FOSUserEvents::CHANGE_PASSWORD_COMPLETED => 'addSuccessFlash ' ,
48
+ FOSUserEvents::GROUP_CREATE_COMPLETED => 'addSuccessFlash ' ,
49
49
FOSUserEvents::GROUP_DELETE_COMPLETED => 'addSuccessFlash ' ,
50
- FOSUserEvents::GROUP_EDIT_SUCCESS => 'addSuccessFlash ' ,
51
- FOSUserEvents::PROFILE_EDIT_SUCCESS => 'addSuccessFlash ' ,
52
- FOSUserEvents::REGISTRATION_SUCCESS => 'addSuccessFlash ' ,
53
- FOSUserEvents::RESETTING_RESET_SUCCESS => 'addSuccessFlash ' ,
50
+ FOSUserEvents::GROUP_EDIT_COMPLETED => 'addSuccessFlash ' ,
51
+ FOSUserEvents::PROFILE_EDIT_COMPLETED => 'addSuccessFlash ' ,
52
+ FOSUserEvents::REGISTRATION_COMPLETED => 'addSuccessFlash ' ,
53
+ FOSUserEvents::RESETTING_RESET_COMPLETED => 'addSuccessFlash ' ,
54
54
);
55
55
}
56
56
57
- public function addSuccessFlash (FormEvent $ event )
57
+ public function addSuccessFlash (Event $ event )
58
58
{
59
59
if (!isset (self ::$ successMessages [$ event ->getName ()])) {
60
60
throw new \InvalidArgumentException ('This event does not correspond to a known flash message ' );
0 commit comments