Skip to content

Commit 3e78532

Browse files
committed
[book][routing] Reworking explanation of the ClassName::showAction controller name format
The new explanation matches the quick tour more closely - where I felt it was explained very well
1 parent 8f2d2c8 commit 3e78532

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

book/routing.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,14 +804,17 @@ The controller might look like this:
804804
Notice that Symfony adds the string ``Controller`` to the class name (``Blog``
805805
=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction``).
806806

807+
You could also refer to this controller using its fully-qualified class name
808+
and method: ``Acme\BlogBundle\Controller\BlogController::showAction``.
809+
But if you follow some simple conventions, the logical name is more concise
810+
and allows more flexibility.
811+
807812
.. note::
808813

809-
Symfony also supports two other controller formats. The first contains
810-
one colon separator (e.g. ``service_name:indexAction``) and refers to
811-
the controller as a service (see :doc:`/cookbook/controller/service`).
812-
The second is formatted like ``ControllerClassName::methodName``. When
813-
Symfony sees this format, it will try to create a new instance of ``ControllerClassName``
814-
and then call the ``methodName`` method.
814+
In addition to using the logical name or the fully-qualified class name,
815+
Symfony supports a third way of referring to a controller. This method
816+
uses just one colon separator (e.g. ``service_name:indexAction``) and
817+
refers to the controller as a service (see :doc:`/cookbook/controller/service`).
815818

816819
Route Parameters and Controller Arguments
817820
-----------------------------------------

0 commit comments

Comments
 (0)