@@ -24,7 +24,7 @@ the route stack. For example, the following provider will add the path
24
24
}
25
25
26
26
To use the path provider you must register it in the **DIC ** and add the
27
- ``cmf_routing_auto.provider `` tag and set the **alias ** accordingly.
27
+ ``cmf_routing_auto.provider `` tag and set the **alias ** accordingly:
28
28
29
29
.. configuration-block ::
30
30
@@ -56,14 +56,14 @@ To use the path provider you must register it in the **DIC** and add the
56
56
57
57
$container->setDefinition('my_cms.some_bundle.path_provider.foobar', $definition);
58
58
59
- The **foobar ** path provider is now available as **foobar **.
59
+ The ``FoobarProvider `` is now available as **foobar ** in the routing auto
60
+ configuration.
60
61
61
- .. note ::
62
+ .. caution ::
62
63
63
- The that both path providers and path actions need to be defined with a
64
- scope of "prototype". This ensures that each time the auto routing system
65
- requests the class a new one is given and we do not have any state
66
- problems.
64
+ Both path providers and path actions need to be defined with a scope of
65
+ "prototype". This ensures that each time the auto routing system requests
66
+ the class a new one is given and you do not have any state problems.
67
67
68
68
Adding Path Actions
69
69
~~~~~~~~~~~~~~~~~~~
@@ -77,7 +77,7 @@ registering your new class correctly in the DI configuration.
77
77
This is a very simple implementation from the bundle - it is used to throw an
78
78
exception when a path already exists::
79
79
80
- namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute \PathNotExists;
80
+ namespace Acme\MainBundle\RoutingAuto \PathNotExists;
81
81
82
82
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\PathActionInterface;
83
83
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Exception\CouldNotFindRouteException;
@@ -95,6 +95,9 @@ exception when a path already exists::
95
95
}
96
96
}
97
97
98
+ The ``init() `` method checks if the required options exists and saves the options
99
+ in property. The ``execute() `` method executes the action.
100
+
98
101
It is registered in the DI configuration as follows:
99
102
100
103
.. configuration-block ::
@@ -130,7 +133,11 @@ It is registered in the DI configuration as follows:
130
133
Note the following:
131
134
132
135
* **Scope **: Must *always * be set to *prototype *;
133
- * **Tag **: The tag registers the service with the auto routing system, it can be one of the following;
134
- * ``cmf_routing_auto.exists.action `` - if the action is to be used when a path exists;
135
- * ``cmf_routing_auto.not_exists.action `` - if the action is to be used when a path does not exist;
136
- * **Alias **: The alias of the tag is the name by which you will reference this action in the auto routing schema.
136
+ * **Tag **: The tag registers the service with the auto routing system, it can
137
+ be one of the following:
138
+ * ``cmf_routing_auto.exists.action `` - if the action is to be used when a
139
+ path exists;
140
+ * ``cmf_routing_auto.not_exists.action `` - if the action is to be used when
141
+ a path does not exist;
142
+ * **Alias **: The alias of the tag is the name by which you will reference this
143
+ action in the auto routing configuration.
0 commit comments