Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1aaa491

Browse files
committed
Updated as per feedback.
1 parent0fc72a8 commit1aaa491

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎cookbook/session/locale_sticky_session.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ want to be used as the locale for the given user. In order to achieve the wanted
121121
configuration, you can set the locale which is defined for the user to the session right
122122
after the login. Fortunately, you can hook into the login process and update the user's
123123
session before the redirect to the first page. For this you need an event listener for the
124-
``security.interactive_login`` event.
124+
``security.interactive_login`` event:
125125

126126
..code-block::php
127127
@@ -170,12 +170,13 @@ Then register the listener:
170170
services:
171171
app.user_locale_listener:
172172
class:AppBundle\EventListener\UserLocaleListener
173+
arguments:[@session]
173174
tags:
174175
-{ name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
175176
176177
..code-block::xml
177178
178-
<!-- app/config/config.xml-->
179+
<!-- app/config/services.xml-->
179180
<?xml version="1.0" encoding="UTF-8" ?>
180181
<containerxmlns="http://symfony.com/schema/dic/services"
181182
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -186,6 +187,8 @@ Then register the listener:
186187
<serviceid="app.user_locale_listener"
187188
class="AppBundle\EventListener\UserLocaleListener">
188189
190+
<argumenttype="service"id="session"/>
191+
189192
<tagname="kernel.event_listener"
190193
event="security.interactive_login"
191194
method="onInteractiveLogin" />
@@ -198,8 +201,11 @@ Then register the listener:
198201
// app/config/services.php
199202
$container
200203
->register('app.user_locale_listener', 'AppBundle\EventListener\UserLocaleListener')
201-
->addTag('kernel.event_listener', array('event' => 'security.interactive_login', 'method' => 'onInteractiveLogin'))
202-
;
204+
->addArgument('session')
205+
->addTag(
206+
'kernel.event_listener',
207+
array('event' => 'security.interactive_login', 'method' => 'onInteractiveLogin'
208+
);
203209
204210
..caution::
205211

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp