Skip to content

Commit d82c7e6

Browse files
committed
minor #8637 Added getSubscribedEvents() to UserLocaleSubscriber (cirrosol)
This PR was submitted for the 3.3 branch but it was merged into the 2.7 branch instead (closes #8637). Discussion ---------- Added getSubscribedEvents() to UserLocaleSubscriber The code wasn't working without this. Commits ------- 78ec0c7 Added getSubscribedEvents() to UserLocaleSubscriber
2 parents 5eff13d + 78ec0c7 commit d82c7e6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

session/locale_sticky_session.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ event:
134134
// src/AppBundle/EventListener/UserLocaleListener.php
135135
namespace AppBundle\EventListener;
136136
137+
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
137138
use Symfony\Component\HttpFoundation\Session\Session;
138139
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
140+
use Symfony\Component\Security\Http\SecurityEvents;
139141
140142
/**
141143
* Stores the locale of the user in the session after the
@@ -164,6 +166,13 @@ event:
164166
$this->session->set('_locale', $user->getLocale());
165167
}
166168
}
169+
170+
public static function getSubscribedEvents()
171+
{
172+
return array(
173+
SecurityEvents::INTERACTIVE_LOGIN => array(array('onInteractiveLogin', 15)),
174+
);
175+
}
167176
}
168177
169178
Then register the listener:

0 commit comments

Comments
 (0)