@@ -41,7 +41,10 @@ once in your application to enable them:
41
41
Symfony 5.2. Prior to this, Doctrine Annotations were the only way to
42
42
annotate controller actions with routing configuration.
43
43
44
- This command also creates the following configuration file:
44
+ If you are using :ref: `Symfony Flex <symfony-flex >` this command also
45
+ creates the following configuration file and you're done. If you aren't
46
+ using flex or want to use attributes, the file has to be added manually.
47
+ ``type: annotation `` applies for attributes, too.
45
48
46
49
.. code-block :: yaml
47
50
@@ -54,8 +57,9 @@ This command also creates the following configuration file:
54
57
resource : ../../src/Kernel.php
55
58
type : annotation
56
59
57
- This configuration tells Symfony to look for routes defined as annotations in
58
- any PHP class stored in the ``src/Controller/ `` directory.
60
+ This configuration tells Symfony to look for routes defined as
61
+ annotations/attributes in any PHP class stored in the ``src/Controller/ ``
62
+ directory.
59
63
60
64
Suppose you want to define a route for the ``/blog `` URL in your application. To
61
65
do so, create a :doc: `controller class </controller >` like the following:
@@ -1384,7 +1388,7 @@ A possible solution is to change the parameter requirements to be more permissiv
1384
1388
1385
1389
// src/Controller/DefaultController.php
1386
1390
namespace App\Controller;
1387
-
1391
+
1388
1392
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1389
1393
use Symfony\Component\HttpFoundation\Response;
1390
1394
use Symfony\Component\Routing\Annotation\Route;
@@ -1504,7 +1508,7 @@ when importing the routes.
1504
1508
1505
1509
// src/Controller/BlogController.php
1506
1510
namespace App\Controller;
1507
-
1511
+
1508
1512
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1509
1513
use Symfony\Component\HttpFoundation\Response;
1510
1514
use Symfony\Component\Routing\Annotation\Route;
0 commit comments