@@ -14,9 +14,9 @@ This can be done by "importing" directories into the routing configuration:
1414 .. code-block :: yaml
1515
1616 # config/routes.yaml
17- app :
18- resource : ' @AppBundle/ Controller/'
19- type : annotation # required to enable the Annotation reader for this resource
17+ controllers :
18+ resource : ../src/ Controller/
19+ type : annotation
2020
2121 .. code-block :: xml
2222
@@ -27,8 +27,7 @@ This can be done by "importing" directories into the routing configuration:
2727 xsi : schemaLocation =" http://symfony.com/schema/routing
2828 http://symfony.com/schema/routing/routing-1.0.xsd" >
2929
30- <!-- the type is required to enable the annotation reader for this resource -->
31- <import resource =" @AppBundle/Controller/" type =" annotation" />
30+ <import resource =" ../src/Controller/" type =" annotation" />
3231 </routes >
3332
3433 .. code-block :: php
@@ -38,35 +37,31 @@ This can be done by "importing" directories into the routing configuration:
3837
3938 $collection = new RouteCollection();
4039 $collection->addCollection(
41- // second argument is the type, which is required to enable
42- // the annotation reader for this resource
43- $loader->import("@AppBundle/Controller/", "annotation")
40+ $loader->import("../src/Controller/", "annotation")
4441 );
4542
4643 return $collection;
4744
4845 .. note ::
4946
50- When importing resources from YAML, the key (e.g. ``app ``) is meaningless.
47+ When importing resources from YAML, the key (e.g. ``controllers ``) is meaningless.
5148 Just be sure that it's unique so no other lines override it.
5249
5350The ``resource `` key loads the given routing resource. In this example the
54- resource is a directory, where the ``@AppBundle `` shortcut syntax resolves
55- to the full path of the AppBundle. When pointing to a directory, all files
56- in that directory are parsed and put into the routing.
51+ resource is a directory and all files in that directory are parsed and put into
52+ the routing.
5753
5854.. note ::
5955
60- You can also include other routing configuration files, this is often
61- used to import the routing of third party bundles:
56+ You can also include other routing configuration files:
6257
6358 .. configuration-block ::
6459
6560 .. code-block :: yaml
6661
6762 # config/routes.yaml
6863 app :
69- resource : ' @AcmeOtherBundle /Resources/config/routing.yml '
64+ resource : ' @ThirdPartyBundle /Resources/config/routing.yaml '
7065
7166 .. code-block :: xml
7267
@@ -77,7 +72,7 @@ in that directory are parsed and put into the routing.
7772 xsi : schemaLocation =" http://symfony.com/schema/routing
7873 http://symfony.com/schema/routing/routing-1.0.xsd" >
7974
80- <import resource =" @AcmeOtherBundle /Resources/config/routing.xml" />
75+ <import resource =" @ThirdPartyBundle /Resources/config/routing.xml" />
8176 </routes >
8277
8378 .. code-block :: php
@@ -87,7 +82,7 @@ in that directory are parsed and put into the routing.
8782
8883 $collection = new RouteCollection();
8984 $collection->addCollection(
90- $loader->import("@AcmeOtherBundle /Resources/config/routing.php")
85+ $loader->import("@ThirdPartyBundle /Resources/config/routing.php")
9186 );
9287
9388 return $collection;
@@ -96,16 +91,16 @@ Prefixing Imported Routes
9691~~~~~~~~~~~~~~~~~~~~~~~~~
9792
9893You can also choose to provide a "prefix" for the imported routes. For example,
99- suppose you want to prefix all routes in the AppBundle with ``/site `` (e.g.
94+ suppose you want to prefix all application routes with ``/site `` (e.g.
10095``/site/blog/{slug} `` instead of ``/blog/{slug} ``):
10196
10297.. configuration-block ::
10398
10499 .. code-block :: yaml
105100
106101 # config/routes.yaml
107- app :
108- resource : ' @AppBundle /Controller/'
102+ controllers :
103+ resource : ' ../src /Controller/'
109104 type : annotation
110105 prefix : /site
111106
@@ -119,7 +114,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
119114 http://symfony.com/schema/routing/routing-1.0.xsd" >
120115
121116 <import
122- resource =" @AppBundle /Controller/"
117+ resource =" ../src /Controller/"
123118 type =" annotation"
124119 prefix =" /site" />
125120 </routes >
@@ -129,7 +124,7 @@ suppose you want to prefix all routes in the AppBundle with ``/site`` (e.g.
129124 // config/routes.php
130125 use Symfony\Component\Routing\RouteCollection;
131126
132- $app = $loader->import('@AppBundle /Controller/', 'annotation');
127+ $app = $loader->import('../src /Controller/', 'annotation');
133128 $app->addPrefix('/site');
134129
135130 $collection = new RouteCollection();
0 commit comments