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

Use allowed_locales in routing.yml #148

Open
ghost opened this issue Apr 24, 2015 · 5 comments
Open

Use allowed_locales in routing.yml #148

ghost opened this issue Apr 24, 2015 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 24, 2015

Any idea how to get this working?

resource: "@ExampleBundle/Resources/config/routing.yml"
prefix:   /{_locale}
requirements:
  _locale: %lunetics_locale.allowed_locales%

Error:

 The container parameter "lunetics_locale.allowed_locales", used in the route configuration value "%lunetics_locale.allowed_locales%", must be a string or numeric, but it is of type array.
@dbu
Copy link
Collaborator

dbu commented Apr 24, 2015

maybe with the expression language, if you are on symfony 2.4 or higher?

@lunetics
Copy link
Collaborator

You could add another variable with _regex% suffix and transform it into a
regex string in the configurations
Am 24.04.2015 09:11 schrieb "JHGitty" notifications@github.com:

Any idea how to get this working?

resource: "@ExampleBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: %lunetics_locale.allowed_locales%

Error:

The container parameter "lunetics_locale.allowed_locales", used in the route configuration value "%lunetics_locale.allowed_locales%", must be a string or numeric, but it is of type array.


Reply to this email directly or view it on GitHub
#148.

@ghost
Copy link
Author

ghost commented Apr 26, 2015

Is there any other way to add the prefix?

@dbu
Copy link
Collaborator

dbu commented Apr 26, 2015

@JHGitty those 2 methods seem to me the most obvious ones, can't think of others. you would need to make the implode function available for expressions and use that.

@ghost
Copy link
Author

ghost commented Apr 26, 2015

I think it would be great if the documentation would contain an example for this. There is already an example for subdomains.

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

No branches or pull requests

2 participants