From 535bfcbe80de5d697b768c3a657214fdeff0eac3 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 30 Oct 2016 09:58:39 +0100 Subject: Move related event things in Event folder --- .../CoreBundle/EventListener/LocaleListener.php | 44 ---------------------- .../EventListener/UserLocaleListener.php | 37 ------------------ 2 files changed, 81 deletions(-) delete mode 100644 src/Wallabag/CoreBundle/EventListener/LocaleListener.php delete mode 100644 src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php (limited to 'src/Wallabag/CoreBundle/EventListener') diff --git a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php b/src/Wallabag/CoreBundle/EventListener/LocaleListener.php deleted file mode 100644 index a1c7e5ab..00000000 --- a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php +++ /dev/null @@ -1,44 +0,0 @@ -defaultLocale = $defaultLocale; - } - - public function onKernelRequest(GetResponseEvent $event) - { - $request = $event->getRequest(); - if (!$request->hasPreviousSession()) { - return; - } - - // try to see if the locale has been set as a _locale routing parameter - if ($locale = $request->attributes->get('_locale')) { - $request->getSession()->set('_locale', $locale); - } else { - // if no explicit locale has been set on this request, use one from the session - $request->setLocale($request->getSession()->get('_locale', $this->defaultLocale)); - } - } - - public static function getSubscribedEvents() - { - return [ - // must be registered before the default Locale listener - KernelEvents::REQUEST => [['onKernelRequest', 17]], - ]; - } -} diff --git a/src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php b/src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php deleted file mode 100644 index 82d1a63a..00000000 --- a/src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php +++ /dev/null @@ -1,37 +0,0 @@ -session = $session; - } - - /** - * @param InteractiveLoginEvent $event - */ - public function onInteractiveLogin(InteractiveLoginEvent $event) - { - $user = $event->getAuthenticationToken()->getUser(); - - if (null !== $user->getConfig()->getLanguage()) { - $this->session->set('_locale', $user->getConfig()->getLanguage()); - } - } -} -- cgit v1.2.3