Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f635838

Browse files
richardmiller-zzweaverryan
authored andcommitted
Changing controllers as services with annotations ot a tip
1 parent c363f66 commit f635838

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

cookbook/controller/service.rst

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,12 @@ the route ``_controller`` value:
120120
'_controller' => 'acme.hello.controller:indexAction',
121121
)));
122122
123-
Using Annotation Routing
124-
~~~~~~~~~~~~~~~~~~~~~~~~
123+
.. tip::
125124

126-
When using annotations to configure routing using a controller defined as a
127-
service, you need to specify the service id as follows::
128-
129-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
130-
131-
/**
132-
* @Route("/hello", service="acme.hello.controller")
133-
*/
134-
class HelloController extends Controller
135-
{
136-
// ...
137-
}
138-
139-
This is documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing`
140-
chapter.
125+
You can also use annotations to configure routing using a controller
126+
defined as a service. See the
127+
:doc:`FrameworkExtraBundle documentation</bundles/SensioFrameworkExtraBundle/annotations/routing>`
128+
for details.
141129

142130
Alternatives to Base Controller Methods
143131
---------------------------------------
@@ -224,7 +212,9 @@ argument:
224212
<!-- src/Acme/HelloBundle/Resources/config/services.xml -->
225213
<parameters>
226214
<!-- ... -->
227-
<parameter key="acme.controller.hello.class">Acme\HelloBundle\Controller\HelloController</parameter>
215+
<parameter
216+
key="acme.controller.hello.class"
217+
>Acme\HelloBundle\Controller\HelloController</parameter>
228218
</parameters>
229219
230220
<services>

0 commit comments

Comments
 (0)