Skip to content

[2.0.*] Locale switcher not working with locale storage #17646

@JordiDekker

Description

@JordiDekker

Sylius version affected: 2.0.*

Description
When disabling localised urls in Sylius 2 an exception is thrown:

In CheckExceptionOnInvalidReferenceBehaviorPass.php line 116:
                                                                                                                      
  The service "sylius_shop.locale_switcher" has a dependency on a non-existent service "sylius_shop.locale_storage".

Steps to reproduce

  1. Add to config/packages/_sylius.yaml:
sylius_shop:
    locale_switcher: storage
  1. Update config/routes/sylius_shop.yml from:
sylius_shop:
    resource: "@SyliusShopBundle/Resources/config/routing.yml"
    prefix: /{_locale}
    requirements:
        _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$

sylius_shop_default_locale:
    path: /
    methods: [GET]
    defaults:
        _controller: sylius_shop.controller.locale_switch::switchAction

to:

sylius_shop:
    resource: "@SyliusShopBundle/Resources/config/routing.yml"
  1. Clear cache using bin/console cache:clear

Possible Solution
Fix configuration of the sylius_shop.locale_switcher service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConfirmed bugs or bugfixes.ShopShopBundle related issues and PRs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions