8000 Tweak · symfony/symfony-docs@064c106 · GitHub
[go: up one dir, main page]

Skip to content

Commit 064c106

Browse files
committed
Tweak
1 parent f0b0134 commit 064c106

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

routing.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ following configuration file:
4646
This configuration tells Symfony to look for routes defined as annotations in
4747
any PHP class stored in the ``src/Controller/`` directory.
4848

49-
.. caution::
50-
51-
If you define multiple PHP class per file, only the first declared class can be loaded, try to define one PHP class per file instead, visit `PSR-4 <https://www.php-fig.org/psr/psr-4/>`_ for more details.
52-
5349
Suppose you want to define a route for the ``/blog`` URL in your application. To
5450
do so, create a :doc:`controller class </controller>` like the following::
5551

@@ -80,6 +76,11 @@ the ``list()`` method of the ``BlogController`` class.
8076
example, URLs like ``/blog?foo=bar`` and ``/blog?foo=bar&bar=foo`` will
8177
also match the ``blog_list`` route.
8278

79+
.. caution::
80+
81+
If you define multiple PHP classes in the same file, Symfony only loads the
82+
routes of the first class, ignoring all the other routes.
83+
8384
The route name (``blog_list``) is not important for now, but it will be
8485
essential later when :ref:`generating URLs <routing-generating-urls>`. You only
8586
have to keep in mind that each route name must be unique in the application.

0 commit comments

Comments
 (0)
0