@@ -882,6 +882,7 @@ and in route imports. Symfony defines some special attributes with the same name
882
882
.. code-block :: php-annotations
883
883
884
884
// src/Controller/ArticleController.php
885
+ namespace App\Controller;
885
886
886
887
// ...
887
888
class ArticleController extends AbstractController
@@ -969,6 +970,9 @@ the controllers of the routes:
969
970
970
971
.. code-block :: php-annotations
971
972
973
+ // src/Controller/BlogController.php
974
+ namespace App\Controller;
975
+
972
976
use Symfony\Component\Routing\Annotation\Route;
973
977
974
978
class BlogController
@@ -1039,6 +1043,9 @@ A possible solution is to change the parameter requirements to be more permissiv
1039
1043
1040
1044
.. code-block :: php-annotations
1041
1045
1046
+ // src/Controller/DefaultController.php
1047
+ namespace App\Controller;
1048
+
1042
1049
use Symfony\Component\Routing\Annotation\Route;
1043
1050
1044
1051
class DefaultController
@@ -1124,6 +1131,9 @@ the common configuration using options when importing the routes.
1124
1131
1125
1132
.. code-block :: php-annotations
1126
1133
1134
+ // src/Controller/BlogController.php
1135
+ namespace App\Controller;
1136
+
1127
1137
use Symfony\Component\Routing\Annotation\Route;
1128
1138
1129
1139
/**
@@ -1140,7 +1150,7 @@ the common configuration using options when importing the routes.
1140
1150
}
1141
1151
1142
1152
/**
1143
- * @Route("/{_locale}/posts/{slug}", name="post ")
1153
+ * @Route("/{_locale}/posts/{slug}", name="show ")
1144
1154
*/
1145
1155
public function show(Post $post)
1146
1156
{
@@ -1216,7 +1226,7 @@ the common configuration using options when importing the routes.
1216
1226
1217
1227
In this example, the route of the ``index() `` action will be called ``blog_index ``
1218
1228
and its URL will be ``/blog/ ``. The route of the ``show() `` action will be called
1219
- ``blog_post `` and its URL will be ``/blog/{_locale}/posts/{slug} ``. Both routes
1229
+ ``blog_show `` and its URL will be ``/blog/{_locale}/posts/{slug} ``. Both routes
1220
1230
will also validate that the ``_locale `` parameter matches the regular expression
1221
1231
defined in the class annotation.
1222
1232
@@ -1838,6 +1848,8 @@ you only need to add an argument in the service constructor and type-hint it wit
1838
1848
the :class: `Symfony\\ Component\\ Routing\\ Generator\\ UrlGeneratorInterface ` class::
1839
1849
1840
1850
// src/Service/SomeService.php
1851
+ namespace App\Service;
1852
+
1841
1853
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1842
1854
1843
1855
class SomeService
@@ -1943,6 +1955,8 @@ generate URLs. This context can be configured globally for all commands:
1943
1955
This information can be configured per command too::
1944
1956
1945
1957
// src/Command/SomeCommand.php
1958
+ namespace App\Command;
1959
+
1946
1960
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1947
1961
use Symfony\Component\Routing\RouterInterface;
1948
1962
// ...
@@ -2075,7 +2089,7 @@ each route explicitly:
2075
2089
# config/routes.yaml
2076
2090
login :
2077
2091
path : /login
2078
- controller : App\Controller\SeurityController ::login
2092
+ controller : App\Controller\SecurityController ::login
2079
2093
schemes : [https]
2080
2094
2081
2095
.. code-block :: xml
0 commit comments