File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -36,18 +36,20 @@ Otherwise, create the following file manually:
3636
3737 # config/routes/attributes.yaml
3838 controllers :
39- resource : ../../src/Controller/
40- type : attribute@App\Controller
39+ resource :
40+ path : ../../src/Controller/
41+ namespace : App\Controller
42+ type : attribute
4143
4244 kernel :
4345 resource : App\Kernel
4446 type : attribute
4547
4648 This configuration tells Symfony to look for routes defined as attributes on
47- classes declared in the ``App\Controller `` namespace which are stored in the
48- ``src/Controller/ `` directory which follows the PSR-4 standard. In addition,
49- our kernel can act as a controller as well which is especially useful for small
50- applications that use Symfony as a microframework.
49+ classes declared in the ``App\Controller `` namespace and stored in the
50+ ``src/Controller/ `` directory which follows the PSR-4 standard. The kernel can
51+ act as a controller too, which is especially useful for small applications that
52+ use Symfony as a microframework.
5153
5254.. versionadded :: 6.2
5355
Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ Symfony provides several route loaders for the most common needs:
2626
2727 app_psr4 :
2828 # loads routes from the PHP attributes of the controllers found in the given PSR-4 namespace root
29- resource : ' ../src/Controller/'
30- type : attribute@App\Controller
29+ resource :
30+ path : ' ../src/Controller/'
31+ namespace : App\Controller
32+ type : attribute
3133
3234 app_attributes :
3335 # loads routes from the PHP attributes of the controllers found in that directory
@@ -62,7 +64,9 @@ Symfony provides several route loaders for the most common needs:
6264 <import resource =" @AcmeBundle/Resources/config/routing.yaml" />
6365
6466 <!-- loads routes from the PHP attributes of the controllers found in the given PSR-4 namespace root -->
65- <import resource =" ../src/Controller/" type =" attribute@App\Controller" />
67+ <import type =" attribute" >
68+ <resource path =" ../src/Controller/" namespace =" App\Controller" />
69+ </import >
6670
6771 <!-- loads routes from the PHP attributes of the controllers found in that directory -->
6872 <import resource =" ../src/Controller/" type =" attribute" />
@@ -111,8 +115,7 @@ Symfony provides several route loaders for the most common needs:
111115
112116.. versionadded :: 6.2
113117
114- The possibility to suffix the ``attribute `` resource type with a PSR-4
115- namespace root was introduced in Symfony 6.2.
118+ The feature to import routes from a PSR-4 namespace root was introduced in Symfony 6.2.
116119
117120.. note ::
118121
You can’t perform that action at this time.
0 commit comments