Skip to content
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

Fixed code example #6256

Closed
wants to merge 2 commits into from
Closed

Fixed code example #6256

wants to merge 2 commits into from

Conversation

twifty
Copy link

@twifty twifty commented Feb 10, 2016

The new subscriber must be called after the default listener. The default sets the locale as

$locale = $request->attributes->get('_locale');
$request->setLocale($locale);

which overwrites any local set before it.

The new subscriber must be called after the default listener. The default sets the locale as
````php
$locale = $request->attributes->get('_locale');
$request->setLocale($locale);
````
which overwrites any local set before it.
// must be registered before the default Locale listener
KernelEvents::REQUEST => array(array('onKernelRequest', 17)),
// must be registered after the default Locale listener
KernelEvents::REQUEST => array(array('onKernelRequest', 16)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use 15 to be sure that it's executed after (the default listener is on 16)

@wouterj
Copy link
Member

wouterj commented Feb 10, 2016

👍 Seems 100% valid to me, thanks for submitting the fix!

@javiereguiluz
Copy link
Member

👍

@xabbuh
Copy link
Member

xabbuh commented Feb 12, 2016

Good catch, thanks @twifty.

xabbuh added a commit that referenced this pull request Feb 12, 2016
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #6256).

Discussion
----------

Fixed code example

The new subscriber must be called after the default listener. The default sets the locale as
````php
$locale = $request->attributes->get('_locale');
$request->setLocale($locale);
````
which overwrites any local set before it.

Commits
-------

50bca94 Fixed code example
@xabbuh xabbuh closed this Feb 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants