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

fix(LocaleBundle): Changing locale using PUT, PATCH works now. #2536

Merged
merged 1 commit into from
Mar 4, 2015
Merged

fix(LocaleBundle): Changing locale using PUT, PATCH works now. #2536

merged 1 commit into from
Mar 4, 2015

Conversation

aramalipoor
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets -
License MIT
Doc PR -

I needed to change locale using PATCH like below:

acme_api_locale_current_put:
    path: /current
    methods: [PUT, PATCH]
    defaults:
        _controller: sylius.controller.locale:changeAction

But changeAction threw an error:

Controller "Sylius\Bundle\LocaleBundle\Controller\LocaleController::changeAction()"
requires that you provide a value for the "$locale" argument
(because there is no default value or because there is a non optional argument after this one).

@stloyd
Copy link
Contributor

stloyd commented Mar 4, 2015

@pjedrzejewski @Arn0d Sounds reasonable...

$this->getLocaleContext()->setLocale($locale);

$config = $this->getConfiguration();
Copy link
Member

Choose a reason for hiding this comment

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

You can just do $this->config.

@aramalipoor
Copy link
Contributor Author

@pjedrzejewski Is it ok? :)

@amenophis
Copy link
Contributor

@aramalipoor Please squash your commits

…PUT, PATCH work.

fix(LocaleBundle): Do not redirect on changeAction when it's an API request.
pjedrzejewski pushed a commit that referenced this pull request Mar 4, 2015
fix(LocaleBundle): Changing locale using PUT, PATCH works now.
@pjedrzejewski pjedrzejewski merged commit 16e249a into Sylius:master Mar 4, 2015
@pjedrzejewski
Copy link
Member

Thank you Aram! 👍

@aramalipoor aramalipoor deleted the patch-1 branch March 9, 2015 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants