Skip to content

Commit ac6b008

Browse files
DHagerwouterj
authored andcommitted
Add warning about a pitfall where the controller seems to be instantiated without using the service-definition
1 parent 70c980d commit ac6b008

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cookbook/controller/service.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ 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+
7986
Referring to the Service
8087
------------------------
8188

0 commit comments

Comments
 (0)