I write about my problem because i think some others begginer on Symfony3 might also have the problem with the route.
In fact, when we have a route declaration to add a prefix like /front/ for the front and /front/admin/ for the admin for exemple, we need to be carefull about the order we put the declarations in the routing.yml file.
Indeed, we will put the less specific route first, then the more specific one ( / = less specific, /arg1/arg2/arg3/etc... = more specific).
So in the routing.yml file, we will NOT declare it this way :
admin_monmodule:
resource: "@MonmoduleBundle/Controller/Admin"
type: annotation
prefix: /admin/{_locale}/
requirements:
_locale: "%locale_choices%"
defaults:
_locale: "%default_locales%"
frontend_monmodule:
resource: "@MonmoduleBundle/Controller"
type: annotation
prefix: /{_locale}/
requirements:
_locale: "%locale_choices%"
defaults:
_locale: "%default_locales%"
but we rather will do it like this:
frontend_monmodule:
resource: "@MonmoduleBundle/Controller"
type: annotation
prefix: /{_locale}/
requirements:
_locale: "%locale_choices%"
defaults:
_locale: "%default_locales%"
admin_monmodule:
resource: "@MonmoduleBundle/Controller/Admin"
type: annotation
prefix: /admin/{_locale}/
requirements:
_locale: "%locale_choices%"
defaults:
_locale: "%default_locales%"
I hope it will help others (and i'm not the only one to struggled with this problem xD)