@@ -877,6 +877,7 @@ and in route imports. Symfony defines some special attributes with the same name
877
877
.. code-block :: php-annotations
878
878
879
879
// src/Controller/ArticleController.php
880
+ namespace App\Controller;
880
881
881
882
// ...
882
883
class ArticleController extends AbstractController
@@ -960,6 +961,9 @@ the controllers of the routes:
960
961
961
962
.. code-block :: php-annotations
962
963
964
+ // src/Controller/BlogController.php
965
+ namespace App\Controller;
966
+
963
967
use Symfony\Component\Routing\Annotation\Route;
964
968
965
969
class BlogController
@@ -1030,6 +1034,9 @@ A possible solution is to change the parameter requirements to be more permissiv
1030
1034
1031
1035
.. code-block :: php-annotations
1032
1036
1037
+ // src/Controller/DefaultController.php
1038
+ namespace App\Controller;
1039
+
1033
1040
use Symfony\Component\Routing\Annotation\Route;
1034
1041
1035
1042
class DefaultController
@@ -1115,6 +1122,9 @@ the common configuration using options when importing the routes.
1115
1122
1116
1123
.. code-block :: php-annotations
1117
1124
1125
+ // src/Controller/BlogController.php
1126
+ namespace App\Controller;
1127
+
1118
1128
use Symfony\Component\Routing\Annotation\Route;
1119
1129
1120
1130
/**
@@ -1131,7 +1141,7 @@ the common configuration using options when importing the routes.
1131
1141
}
1132
1142
1133
1143
/**
1134
- * @Route("/{_locale}/posts/{slug}", name="post ")
1144
+ * @Route("/{_locale}/posts/{slug}", name="show ")
1135
1145
*/
1136
1146
public function show(Post $post)
1137
1147
{
@@ -1207,7 +1217,7 @@ the common configuration using options when importing the routes.
1207
1217
1208
1218
In this example, the route of the ``index() `` action will be called ``blog_index ``
1209
1219
and its URL will be ``/blog/ ``. The route of the ``show() `` action will be called
1210
- ``blog_post `` and its URL will be ``/blog/{_locale}/posts/{slug} ``. Both routes
1220
+ ``blog_show `` and its URL will be ``/blog/{_locale}/posts/{slug} ``. Both routes
1211
1221
will also validate that the ``_locale `` parameter matches the regular expression
1212
1222
defined in the class annotation.
1213
1223
@@ -1822,6 +1832,8 @@ you only need to add an argument in the service constructor and type-hint it wit
1822
1832
the :class: `Symfony\\ Component\\ Routing\\ Generator\\ UrlGeneratorInterface ` class::
1823
1833
1824
1834
// src/Service/SomeService.php
1835
+ namespace App\Service;
1836
+
1825
1837
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1826
1838
1827
1839
class SomeService
@@ -1927,6 +1939,8 @@ generate URLs. This context can be configured globally for all commands:
1927
1939
This information can be configured per command too::
1928
1940
1929
1941
// src/Command/SomeCommand.php
1942
+ namespace App\Command;
1943
+
1930
1944
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1931
1945
use Symfony\Component\Routing\RouterInterface;
1932
1946
// ...
@@ -2059,7 +2073,7 @@ each route explicitly:
2059
2073
# config/routes.yaml
2060
2074
login :
2061
2075
path : /login
2062
- controller : App\Controller\SeurityController ::login
2076
+ controller : App\Controller\SecurityController ::login
2063
2077
schemes : [https]
2064
2078
2065
2079
.. code-block :: xml
0 commit comments