Skip to content

Commit 4e9ce48

Browse files
committed
fix controller matching documentation and add warning. fix #134
1 parent 8597598 commit 4e9ce48

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Resources/doc/reference/configuration/headers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ checked in the order specified, where the first match wins.
2727
# match all actions of a specific controller
2828
-
2929
match:
30-
attributes: { _controller: ^AcmeBundle:Default:.* }
30+
attributes: { _controller: ^Acme\\TestBundle\\Controller\\DefaultController::.* }
3131
additional_cacheable_status: [400]
3232
headers:
3333
cache_control:

Resources/doc/reference/configuration/match.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,16 @@ _controller
8181

8282
Controller name regular expression. Note that this is the controller name used
8383
in the route, so it depends on your route configuration whether you need
84-
``Bundle:Name:action`` or ``service.id:methodName`` (if you defined your
85-
`controllers as services`_).
84+
``Acme\\TestBundle\\Controller\\NameController::hello`` or ``acme_test.controller.name:helloAction``
85+
for `controllers as services`_.
86+
87+
.. warning::
88+
89+
Symfony always expands the short notation in route definitions. Even if you
90+
define your route as ``AcmeTestBundle:Name:hello`` you still need to use
91+
the long form here. If you use a service however, the compiled route still
92+
uses the service name and you need to match on that. If you mixed both, you
93+
can do a regular expression like ``^(Acme\\TestBundle|acme_test.controller)``.
8694

8795
_route
8896
^^^^^^

0 commit comments

Comments
 (0)