Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions best_practices/controllers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,19 @@ this suffix is neither required nor recommended, so you can safely remove it.
Routing Configuration
---------------------

To load routes defined as annotations in your controllers, add the following
configuration to the main routing configuration file:
To load routes defined as annotations in your controllers, run the following command:

.. code-block:: terminal

$ composer require doctrine/annotations

Thanks to the :doc:`Flex recipe</setup/flex>`, a ``config/routes/annotations.yaml`` file will be created:

.. code-block:: yaml

# config/routes.yaml
# config/routes/annotations.yaml
controllers:
resource: '../src/Controller/'
resource: '../../src/Controller/'
type: annotation

This configuration will load annotations from any controller stored inside the
Expand Down