@@ -13,7 +13,8 @@ The goal of a ``PathProvider`` class is to add one or several path elements to
13
13
the route stack. For example, the following provider will add the path
14
14
``foo/bar `` to the route stack::
15
15
16
- <?php
16
+ // src/Acme/CmsBundle/RoutingAuto/PathProvider/FoobarProvider.php
17
+ namespace Acme\CmsBundle\RoutingAuto\PathProvider;
17
18
18
19
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\PathProviderInterface;
19
20
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack;
@@ -33,35 +34,35 @@ To use the path provider you must register it in the container and add the
33
34
34
35
.. code-block :: yaml
35
36
36
- # app/config/config.yml
37
37
services :
38
- my_cms_bundle .path_provider.foobar :
39
- class : " FoobarProvider"
38
+ acme_cms .path_provider.foobar :
39
+ class : Acme\CmsBundle\RoutingAuto\PathProvider\ FoobarProvider
40
40
scope : prototype
41
41
tags :
42
42
- { name: cmf_routing_auto.provider, alias: "foobar"}
43
43
44
44
.. code-block :: xml
45
45
46
- <!-- app/config/config.xml -->
47
- <service
48
- id =" my_cms_bundle.path_provider.foobar"
49
- class =" FoobarProvider"
50
- scope =" prototype"
51
- >
52
- <tag name =" cmf_routing_auto.provider" alias =" foobar" />
53
- </service >
46
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
47
+ <container xmlns =" http://symfony.com/schema/dic/services" >
48
+ <service
49
+ id =" acme_cms.path_provider.foobar"
50
+ class =" Acme\CmsBundle\RoutingAuto\PathProvider\FoobarProvider"
51
+ scope =" prototype"
52
+ >
53
+ <tag name =" cmf_routing_auto.provider" alias =" foobar" />
54
+ </service >
55
+ </container >
54
56
55
57
.. code-block :: php
56
58
57
- // app/config/config.php
58
59
use Symfony\Component\DependencyInjection\Definition;
59
60
60
- $definition = new Definition('FooBarProvider ');
61
+ $definition = new Definition('Acme\CmsBundle\RoutingAuto\PathProvider\FoobarProvider ');
61
62
$definition->addTag('cmf_routing_auto.provider', array('alias' => 'foobar'));
62
63
$definition->setScope('prototype');
63
64
64
- $container->setDefinition('my_cms_bundle .path_provider.foobar', $definition);
65
+ $container->setDefinition('acme_cms .path_provider.foobar', $definition);
65
66
66
67
The ``FoobarProvider `` is now available as **foobar ** in the routing auto
67
68
configuration.
@@ -84,7 +85,7 @@ registering your new class correctly in the DI configuration.
84
85
This is a very simple implementation from the bundle - it is used to throw an
85
86
exception when a path already exists::
86
87
87
- namespace Acme\MainBundle \RoutingAuto\PathNotExists;
88
+ namespace Symfony\Cmf\Bundle\RoutingAutoBundle \RoutingAuto\PathNotExists;
88
89
89
90
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\PathActionInterface;
90
91
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Exception\CouldNotFindRouteException;
@@ -111,35 +112,35 @@ It is registered in the DI configuration as follows:
111
112
112
113
.. code-block :: yaml
113
114
114
- # app/config/config.xml
115
115
services :
116
- cmf_routing_auto.not_exists_action.throw_exception
117
- class : " My \C ms \A utoRoute \ P athNotExists\T hrowException"
116
+ cmf_routing_auto.not_exists_action.throw_exception :
117
+ class : Symfony\Cmf\Bundle\RoutingAutoBundle\RoutingAuto\ PathNotExists\ThrowException
118
118
scope : prototype
119
119
tags :
120
120
- { name: cmf_routing_auto.provider, alias: "throw_exception"}
121
121
122
122
.. code-block :: xml
123
123
124
- <!-- app/config/config.xml -->
125
- <service
126
- id =" my_cms.not_exists_action.throw_exception"
127
- class =" My\Cms\AutoRoute\PathNotExists\ThrowException"
128
- scope =" prototype"
129
- >
130
- <tag name =" cmf_routing_auto.not_exists_action" alias =" throw_exception" />
131
- </service >
124
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
125
+ <container xmlns =" http://symfony.com/schema/dic/services" >
126
+ <service
127
+ id =" cmf_routing_auto.not_exists_action.throw_exception"
128
+ class =" Symfony\Cmf\Bundle\RoutingAutoBundle\RoutingAuto\PathNotExists\ThrowException"
129
+ scope =" prototype"
130
+ >
131
+ <tag name =" cmf_routing_auto.not_exists_action" alias =" throw_exception" />
132
+ </service >
133
+ </container >
132
134
133
135
.. code-block :: php
134
136
135
- // app/config/config.php
136
137
use Symfony\Component\DependencyInjection\Definition;
137
138
138
- $definition = new Definition('My\Cms\AutoRoute \PathNotExists\ThrowException');
139
+ $definition = new Definition('Symfony\Cmf\Bundle\RoutingAutoBundle\RoutingAuto \PathNotExists\ThrowException');
139
140
$definition->addTag('cmf_routing_auto.provider', array('alias' => 'throw_exception'));
140
141
$definition->setScope('prototype');
141
142
142
- $container->setDefinition('my_cms.some_bundle.path_provider .throw_exception', $definition);
143
+ $container->setDefinition('cmf_routing_auto.not_exists_action .throw_exception', $definition);
143
144
144
145
Note the following:
145
146
0 commit comments