Skip to content

Commit aa148c7

Browse files
committed
Moved the flash messages to the completed events
1 parent 71d0abf commit aa148c7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

EventListener/FlashListener.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212
namespace FOS\UserBundle\EventListener;
1313

1414
use FOS\UserBundle\FOSUserEvents;
15-
use FOS\UserBundle\Event\FormEvent;
15+
use Symfony\Component\EventDispatcher\Event;
1616
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1717
use Symfony\Component\HttpFoundation\Session\SessionInterface;
1818
use Symfony\Component\Translation\TranslatorInterface;
1919

2020
class FlashListener implements EventSubscriberInterface
2121
{
2222
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',
2525
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',
3030
);
3131

3232
/**
@@ -44,17 +44,17 @@ public function __construct(SessionInterface $session, TranslatorInterface $tran
4444
public static function getSubscribedEvents()
4545
{
4646
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',
4949
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',
5454
);
5555
}
5656

57-
public function addSuccessFlash(FormEvent $event)
57+
public function addSuccessFlash(Event $event)
5858
{
5959
if (!isset(self::$successMessages[$event->getName()])) {
6060
throw new \InvalidArgumentException('This event does not correspond to a known flash message');

0 commit comments

Comments
 (0)