Skip to content

Commit

Permalink
Merge caution with annotations tip
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jul 8, 2016
1 parent ac6b008 commit 93bb21c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions cookbook/controller/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ Then you can define it as a service as follows:
'AppBundle\Controller\HelloController'
));
.. caution::

If you are managing your routes with PHP annotation, you may need to add an
``@Route`` annotation to the controller-class which specifies its service
ID. If you don't, the system may try to construct your controller without
any arguments. See the `FrameworkExtraBundle documentation`_ for details.

Referring to the Service
------------------------

Expand Down Expand Up @@ -126,7 +119,8 @@ the route ``_controller`` value:
.. tip::

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

.. tip::
Expand Down Expand Up @@ -345,4 +339,4 @@ controller:

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

0 comments on commit 93bb21c

Please sign in to comment.