本文介绍了Symfony2:在多个文件中拆分 routing.yml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 routing.yml 文件,我在其中定义了我的包的路由.我的路由文件越来越大.

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

有没有办法将routing.yml文件拆分成多个文件?例如:

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

  • user_routing.yml
  • vehicles_routing.yml
  • cost_centers_routing.yml

注意:我使用的是 Symfony 2.2;

NOTE: I am using Symfony 2.2;

推荐答案

routing.yml 可以拆分成多个文件.您可以在 routing.yml 文件中包含单独的路由文件.

The routing.yml can split by multiple files. You can include separate routing files in your routing.yml file.

acme_demo_user:
  resource: "@acmeDemoBundle/Resources/config/routing/user_routing.yml"
  prefix: /user
acme_demo_vehicles:
  resource: "@acmeDemoBundle/Resources/config/routing/vehicles_routing.yml"
  prefix: /vehicles
.............
.............

这篇关于Symfony2:在多个文件中拆分 routing.yml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:31