FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.
1.48k stars 261 forks source link

Importing route and prefix path issue #445

Closed benschumi closed 1 year ago

benschumi commented 1 year ago

Hello,

in Symfony 4.4 and FosJsRouting 2.8.0,

i have a file import_routing.yml which is loaded by an AdvancedLoader

SiteEngine_selection: resource: "@SiteEngineSelectionBundle/Resources/config/routing.yml" prefix: /{_locale}/selection requirements: _locale: en|es|de|fr|it|nl|ru

They are some routes in routing.yml what are exposed for FOSJsRoutingBundle

SiteEngineSelectionBundle_getSession: path: /get-session/{type} defaults: { _controller: SiteEngine\SelectionBundle\Controller\SelectionController::getSession } options: expose: true

When i dump the route file, mys fos_js_routes.json don't get the prefix url :

"SiteEngineSelectionBundle_getSession":{"tokens":[["variable","\/","[^\/]++","type"],["text","\/selection\/get-session"],["variable","\/","en|es|de|fr|it|nl|ru","_locale"]],

It was working fine in Symfony 3.4...

"SiteEngineSelectionBundle_getSession":{"path":"\/{_locale}\/selection\/get-session\/{type}","host":"","defaults":{"_controller":"SiteEngine\\SelectionBundle\\Controller\\SelectionController::getSessionAction"},"requirements":{"_locale":"en|es|de|fr|it|nl|ru"},"options":{"compiler_class":"Symfony\\Component\\Routing\\RouteCompiler","expose":true},"schemes":[],"methods":[],"condition":""},

When i use the debug:router command, my route is fine and have the prefix, but not when i dump it

+--------------+------------------------------------------------------------------------------------+ | Property | Value | +--------------+------------------------------------------------------------------------------------+ | Route Name | SiteEngineSelectionBundle_getSession | | Path | /{_locale}/selection/get-session/{type} | | Path Regex | #^/(?P<_locale>en|es|de|fr|it|nl|ru)/selection/get\-session/(?P<type>[^/]++)$#sD | | Host | ANY | | Host Regex | | | Scheme | ANY | | Method | ANY | | Requirements | _locale: en|es|de|fr|it|nl|ru | | Class | Symfony\Component\Routing\Route | | Defaults | _controller: SiteEngine\SelectionBundle\Controller\SelectionController::getSession | | Options | compiler_class: Symfony\Component\Routing\RouteCompiler | | | expose: true | +--------------+------------------------------------------------------------------------------------+

Any ideas ?