Skip to content

Commit 0d8fe69

Browse files
committed
[#1731] Tweaking the note about controllers as services with annotation routing
1 parent 3297b4b commit 0d8fe69

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

cookbook/controller/service.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ you'll interact directly with the services that you need. Fortunately, this is
3535
usually pretty easy and the base ``Controller`` class itself is a great source
3636
on how to perform many common tasks.
3737

38+
.. note::
39+
40+
Specifying a controller as a service takes a little bit more work. The
41+
primary advantage is that the entire controller or any services passed to
42+
the controller can be modified via the service container configuration.
43+
This is especially useful when developing an open-source bundle or any
44+
bundle that will be used in many different projects. So, even if you don't
45+
specify your controllers as services, you'll likely see this done in some
46+
open-source Symfony2 bundles.
47+
48+
Using Annotation Routing
49+
------------------------
50+
3851
When using annotations to setup routing when using a controller defined as a
3952
service, you need to specify your service as follows::
4053

@@ -48,17 +61,5 @@ service, you need to specify your service as follows::
4861

4962
In this example, ``my_bundle.annot_controller`` should be the id of the
5063
``AnnotController`` instance defined in the service container. This is
51-
documented in the :doc:`bundles/SensioFrameworkExtraBundle/annotations/routing`
52-
chapter.
53-
54-
Read more
55-
56-
.. note::
57-
58-
Specifying a controller as a service takes a little bit more work. The
59-
primary advantage is that the entire controller or any services passed to
60-
the controller can be modified via the service container configuration.
61-
This is especially useful when developing an open-source bundle or any
62-
bundle that will be used in many different projects. So, even if you don't
63-
specify your controllers as services, you'll likely see this done in some
64-
open-source Symfony2 bundles.
64+
documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing`
65+
chapter.

0 commit comments

Comments
 (0)