|
4 | 4 | How to Create a custom Route Loader
|
5 | 5 | ===================================
|
6 | 6 |
|
7 |
| -A custom route loader allows you to add routes to an application without |
8 |
| -including them, for example, in a YAML file. This comes in handy when |
9 |
| -you have a bundle but don't want to manually add the routes for the bundle |
10 |
| -to ``app/config/routing.yml``. This may be especially important when you want |
11 |
| -to make the bundle reusable, or when you have open-sourced it as this would |
12 |
| -slow down the installation process and make it error-prone. |
13 |
| - |
14 |
| -Alternatively, you could also use a custom route loader when you want your |
15 |
| -routes to be automatically generated or located based on some convention or |
16 |
| -pattern. One example is the `FOSRestBundle`_ where routing is generated based |
17 |
| -on the names of the action methods in a controller. |
| 7 | +What is a Custom Route Loader |
| 8 | +----------------------------- |
| 9 | + |
| 10 | +A custom route loader enables you to generate routes based on some |
| 11 | +conventions or patterns. A great example for this use-case is the |
| 12 | +`FOSRestBundle`_ where routes are generated based on the names of the |
| 13 | +action methods in a controller. |
| 14 | + |
| 15 | +A custom route loader does not enable your bundle to inject routes |
| 16 | +without the need to modify the routing configuration |
| 17 | +(e.g. ``app/config/routing.yml``) manually. |
| 18 | +If your bundle provides routes, whether via a configuration file, like |
| 19 | +the `WebProfilerBundle` does, or via a custom route loader, like the |
| 20 | +`FOSRestBundle`_ does, an entry in the routing configuration is always |
| 21 | +necessary. |
18 | 22 |
|
19 | 23 | .. note::
|
20 | 24 |
|
|
0 commit comments