-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
This is a feature request/suggestion.
It would pretty nifty to be able to prefix route IDs/names on import. The idea is that the same routing resource could be imported multiple times and generate unique route names.
For example: if you have a typical form login on one host for a UI and a stateless API token authentication on another. You might want to share the same routing config for your API between the two hosts.
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- ... -->
<import resource="@AppBundle/Resources/config/api.xml" prefix="/api" host="%uihost%">
<default key="_format">json</default>
</import>
<import resource="@AppBundle/Resources/config/api.xml" host="%apihost%">
<default key="_format">json</default>
</import>
</routes>
Right now this can't be done. The second import overrides all the named routes in the first. Ideally I'd like to be able to do this...
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing
http://symfony.com/schema/routing/routing-1.0.xsd">
<!-- ... -->
<import resource="@AppBundle/Resources/config/api.xml" prefix="/api" host="%uihost%">
<default key="_format">json</default>
</import>
<import resource="@AppBundle/Resources/config/api.xml" host="%apihost%" idprefix="api.">
<default key="_format">json</default>
</import>
</routes>
All routes in the second import would get the ID api.{original_id_attribute_value}
.
apfelbox, ro0NL, adiachenko, mktcode, samdjstevens and 7 more