Skip to content

Commit

Permalink
Merge pull request #143 from FriendsOfSymfony/fix-controller-matching…
Browse files Browse the repository at this point in the history
…-doc

fix controller matching documentation and add warning
  • Loading branch information
ddeboer committed Aug 19, 2014
2 parents f8a1c19 + 4e9ce48 commit 3b69fca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Resources/doc/reference/configuration/headers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ checked in the order specified, where the first match wins.
# match all actions of a specific controller
-
match:
attributes: { _controller: ^AcmeBundle:Default:.* }
attributes: { _controller: ^Acme\\TestBundle\\Controller\\DefaultController::.* }
additional_cacheable_status: [400]
headers:
cache_control:
Expand Down
12 changes: 10 additions & 2 deletions Resources/doc/reference/configuration/match.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ _controller

Controller name regular expression. Note that this is the controller name used
in the route, so it depends on your route configuration whether you need
``Bundle:Name:action`` or ``service.id:methodName`` (if you defined your
`controllers as services`_).
``Acme\\TestBundle\\Controller\\NameController::hello`` or ``acme_test.controller.name:helloAction``
for `controllers as services`_.

.. warning::

Symfony always expands the short notation in route definitions. Even if you
define your route as ``AcmeTestBundle:Name:hello`` you still need to use
the long form here. If you use a service however, the compiled route still
uses the service name and you need to match on that. If you mixed both, you
can do a regular expression like ``^(Acme\\TestBundle|acme_test.controller)``.

_route
^^^^^^
Expand Down

0 comments on commit 3b69fca

Please sign in to comment.