File tree 2 files changed +16
-11
lines changed
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:
36
36
37
37
# config/routes/attributes.yaml
38
38
controllers :
39
- resource : ../../src/Controller/
40
- type : attribute@App\Controller
39
+ resource :
40
+ path : ../../src/Controller/
41
+ namespace : App\Controller
42
+ type : attribute
41
43
42
44
kernel :
43
45
resource : App\Kernel
44
46
type : attribute
45
47
46
48
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.
51
53
52
54
.. versionadded :: 6.2
53
55
Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ Symfony provides several route loaders for the most common needs:
26
26
27
27
app_psr4 :
28
28
# 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
31
33
32
34
app_attributes :
33
35
# 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:
62
64
<import resource =" @AcmeBundle/Resources/config/routing.yaml" />
63
65
64
66
<!-- 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 >
66
70
67
71
<!-- loads routes from the PHP attributes of the controllers found in that directory -->
68
72
<import resource =" ../src/Controller/" type =" attribute" />
@@ -111,8 +115,7 @@ Symfony provides several route loaders for the most common needs:
111
115
112
116
.. versionadded :: 6.2
113
117
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.
116
119
117
120
.. note ::
118
121
You can’t perform that action at this time.
0 commit comments