Skip to content

Commit 93bb21c

Browse files
committed
Merge caution with annotations tip
1 parent ac6b008 commit 93bb21c

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

cookbook/controller/service.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ Then you can define it as a service as follows:
7676
'AppBundle\Controller\HelloController'
7777
));
7878
79-
.. caution::
80-
81-
If you are managing your routes with PHP annotation, you may need to add an
82-
``@Route`` annotation to the controller-class which specifies its service
83-
ID. If you don't, the system may try to construct your controller without
84-
any arguments. See the `FrameworkExtraBundle documentation`_ for details.
85-
8679
Referring to the Service
8780
------------------------
8881

@@ -126,7 +119,8 @@ the route ``_controller`` value:
126119
.. tip::
127120

128121
You can also use annotations to configure routing using a controller
129-
defined as a service. See the `FrameworkExtraBundle documentation`_ for
122+
defined as a service. Make sure you specify the service ID in the
123+
``@Route`` annotation. See the `FrameworkExtraBundle documentation`_ for
130124
details.
131125

132126
.. tip::
@@ -345,4 +339,4 @@ controller:
345339

346340
.. _`Controller class source code`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
347341
.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
348-
.. _`FrameworkExtraBundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html
342+
.. _`FrameworkExtraBundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/routing.html#controller-as-service

0 commit comments

Comments
 (0)