Skip to content

Commit 1ba8dd9

Browse files
committed
hint about creating config/routes/annotations.yaml as well, when using attributes without doctrine/annotations.
1 parent 9f3a00b commit 1ba8dd9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

routing.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ once in your application to enable them:
4141
Symfony 5.2. Prior to this, Doctrine Annotations were the only way to
4242
annotate controller actions with routing configuration.
4343

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.
4548

4649
.. code-block:: yaml
4750
@@ -54,8 +57,9 @@ This command also creates the following configuration file:
5457
resource: ../../src/Kernel.php
5558
type: annotation
5659
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.
5963

6064
Suppose you want to define a route for the ``/blog`` URL in your application. To
6165
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
13841388
13851389
// src/Controller/DefaultController.php
13861390
namespace App\Controller;
1387-
1391+
13881392
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
13891393
use Symfony\Component\HttpFoundation\Response;
13901394
use Symfony\Component\Routing\Annotation\Route;
@@ -1504,7 +1508,7 @@ when importing the routes.
15041508
15051509
// src/Controller/BlogController.php
15061510
namespace App\Controller;
1507-
1511+
15081512
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
15091513
use Symfony\Component\HttpFoundation\Response;
15101514
use Symfony\Component\Routing\Annotation\Route;

0 commit comments

Comments
 (0)