Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit a80cbe9

Browse files
committed
document the route pre generate event. fix #672
1 parent 1ddde74 commit a80cbe9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

components/routing/dynamic.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,25 @@ Events
3636
------
3737

3838
Optionally, you can provide an `Event Dispatcher`_ to the dynamic router.
39-
If you do, it will trigger one of the following two events during the match
40-
process, depending on which method is used:
39+
If you do, it will trigger one of the pre-match events during the match
40+
process, depending on which method is used and another event before generating
41+
a URL:
4142

4243
* **cmf_routing.pre_dynamic_match** (Dispatched at the beginning of the
4344
``match`` method)
4445
* **cmf_routing.pre_dynamic_match_request** (Dispatched at the beginning of the
4546
``matchRequest`` method. In the context of the Symfony2 full stack framework,
4647
only this event will be triggered.)
48+
* **cmf_routing.pre_dynamic_generate** (Dispatched at the beginning of the
49+
``generate`` method)
50+
51+
..versionadded:: 1.4
52+
The route generate event was added in version 1.4 of the routing component.
53+
54+
Pre-match events are of class ``Symfony\Cmf\Component\Routing\Event\RouterMatchEvent``,
55+
the generate event is of class ``Symfony\Cmf\Component\Routing\Event\RouterGenerateEvent``.
56+
The genereate event also allows you to manipulate the route name, parameters and
57+
reference type in the event, by updating the values in the event.
4758

4859
The ``Symfony\Cmf\Component\Routing\Event\Events`` class contains the event
4960
constants. To learn how to register the events, see

0 commit comments

Comments
 (0)