Skip to content

Use '[]' notation, add missing "()" update class name #9850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions security/impersonating_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The :doc:`/session/locale_sticky_session` article does not update the locale
when you impersonate a user. If you *do* want to be sure to update the locale when
you switch users, add an event subscriber on this event::

// src/EventListener/SwitchUserListener.php
// src/EventListener/SwitchUserSubscriber.php
namespace App\EventListener;

use Symfony\Component\Security\Http\Event\SwitchUserEvent;
Expand All @@ -211,7 +211,7 @@ you switch users, add an event subscriber on this event::
{
$request = $event->getRequest();

if ($request->hasSession() && ($session = $request->getSession)) {
if ($request->hasSession() && ($session = $request->getSession())) {
$session->set(
'_locale',
// assuming your User has some getLocale() method
Expand All @@ -222,10 +222,10 @@ you switch users, add an event subscriber on this event::

public static function getSubscribedEvents()
{
return array(
return [
// constant for security.switch_user
SecurityEvents::SWITCH_USER => 'onSwitchUser',
);
];
}
}

Expand Down