Felurian Felurian - 3 months ago 24
YAML Question

Symfony3: Splitting routing.yml in multiple files

I have a routing.yml file where I define the routes of my bundle. My routing file is growing bigger.

Is there a way to split the routing.yml file in multiple files in Symfony3 ?

I saw this question but it is for Symfony2. The path aren't the same.

In Symfony2, we did like this :

app_catalogs:
resource: "@AppBundle/Resources/config/routing/routing_catalog.yml"
prefix: /catalogs


I tried this but it doesn't work (my file is in the same level than routing.yml) :

app_catalogs:
resource: "app/config/routing_catalog.yml"
prefix: /catalogs

Answer

(When not importing from a bundle), you should use paths relative to the current directory of the configuration file, so for example:

app_catalogs:
    resource: routing_catalog.yml
    prefix: /catalogs