@@ -882,6 +882,7 @@ and in route imports. Symfony defines some special attributes with the same name
882882 .. code-block :: php-annotations
883883
884884 // src/Controller/ArticleController.php
885+ namespace App\Controller;
885886
886887 // ...
887888 class ArticleController extends AbstractController
@@ -969,6 +970,9 @@ the controllers of the routes:
969970
970971 .. code-block :: php-annotations
971972
973+ // src/Controller/BlogController.php
974+ namespace App\Controller;
975+
972976 use Symfony\Component\Routing\Annotation\Route;
973977
974978 class BlogController
@@ -1039,6 +1043,9 @@ A possible solution is to change the parameter requirements to be more permissiv
10391043
10401044 .. code-block :: php-annotations
10411045
1046+ // src/Controller/DefaultController.php
1047+ namespace App\Controller;
1048+
10421049 use Symfony\Component\Routing\Annotation\Route;
10431050
10441051 class DefaultController
@@ -1124,6 +1131,9 @@ the common configuration using options when importing the routes.
11241131
11251132 .. code-block :: php-annotations
11261133
1134+ // src/Controller/BlogController.php
1135+ namespace App\Controller;
1136+
11271137 use Symfony\Component\Routing\Annotation\Route;
11281138
11291139 /**
@@ -1140,7 +1150,7 @@ the common configuration using options when importing the routes.
11401150 }
11411151
11421152 /**
1143- * @Route("/{_locale}/posts/{slug}", name="post ")
1153+ * @Route("/{_locale}/posts/{slug}", name="show ")
11441154 */
11451155 public function show(Post $post)
11461156 {
@@ -1216,7 +1226,7 @@ the common configuration using options when importing the routes.
12161226
12171227 In this example, the route of the ``index() `` action will be called ``blog_index ``
12181228and 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
12201230will also validate that the ``_locale `` parameter matches the regular expression
12211231defined in the class annotation.
12221232
@@ -1838,6 +1848,8 @@ you only need to add an argument in the service constructor and type-hint it wit
18381848the :class: `Symfony\\ Component\\ Routing\\ Generator\\ UrlGeneratorInterface ` class::
18391849
18401850 // src/Service/SomeService.php
1851+ namespace App\Service;
1852+
18411853 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
18421854
18431855 class SomeService
@@ -1943,6 +1955,8 @@ generate URLs. This context can be configured globally for all commands:
19431955 This information can be configured per command too::
19441956
19451957 // src/Command/SomeCommand.php
1958+ namespace App\Command;
1959+
19461960 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
19471961 use Symfony\Component\Routing\RouterInterface;
19481962 // ...
@@ -2075,7 +2089,7 @@ each route explicitly:
20752089 # config/routes.yaml
20762090 login :
20772091 path : /login
2078- controller : App\Controller\SeurityController ::login
2092+ controller : App\Controller\SecurityController ::login
20792093 schemes : [https]
20802094
20812095 .. code-block :: xml
0 commit comments