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

Commit 4c673a5

Browse files
committed
fixes
1 parent 9f740e1 commit 4c673a5

File tree

8 files changed

+60
-64
lines changed

8 files changed

+60
-64
lines changed

bundles/blog.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Dependencies
3636
------------
3737

3838
* :doc:`CmfRoutingBundle <routing/introduction>` is used to manage the routing;
39-
* :doc:`CmfRoutingAutoBundle<routing_auto>` is used to manage automatically generate routes;
40-
* :doc:`PHPCR-ODM<phpcr_odm>` is used to persist the bundles documents.
39+
* :doc:`CmfRoutingAutoBundle <routing_auto/introduction>` is used to manage automatically generate routes;
40+
* :doc:`PHPCR-ODM <phpcr_odm>` is used to persist the bundles documents.
4141

4242
Configuration
4343
-------------
@@ -140,7 +140,8 @@ The default configuration will produce URLs like the following::
140140

141141
http://www.example.com/blogs/dtls-blog/2013-04-14/this-is-my-post
142142

143-
Refer to the :doc:`routing_auto` documentation for more information.
143+
Refer to the :doc:`RoutingAutoBundle <routing_auto/introduction>` documentation
144+
for more information.
144145

145146
Content Routing
146147
~~~~~~~~~~~~~~~

bundles/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Bundles
1212
phpcr_odm
1313
media/index
1414
menu/index
15-
routing_auto
15+
routing_auto/index
1616
routing/index
1717
search/index
1818
simple_cms/index

bundles/map.rst.inc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,27 @@ library or they introduce a complete new concept.
3232
* :doc:`media/form_types`
3333
* :doc:`media/adapters/index`
3434

35-
* **MenuBundle**
35+
* :doc:`menu/index`
3636

37-
* :doc:`menu/index`
37+
* :doc:`menu/introduction`
38+
* :doc:`menu/menu_documents`
39+
* :doc:`menu/menu_factory`
40+
* :doc:`menu/menu_provider`
41+
* :doc:`menu/voters`
3842

3943
* :doc:`routing/index`
4044

4145
* :doc:`routing/introduction`
4246
* :doc:`routing/dynamic`
4347
* :doc:`routing/dynamic_customize`
4448

45-
* **RoutingAutoBundle**
49+
* :doc:`routing_auto/index`
4650

47-
* :doc:`routing_auto`
51+
* :doc:`routing_auto/introduction`
52+
* :doc:`routing_auto/providers`
53+
* :doc:`routing_auto/exists_actions`
54+
* :doc:`routing_auto/not_exists_actions`
55+
* :doc:`routing_auto/customization`
4856

4957
* :doc:`search/index`
5058

bundles/routing_auto/customization.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. index::
2+
single: Customization; RoutingAutoBundle
3+
14
Customization
25
-------------
36

@@ -23,7 +26,7 @@ the route stack. For example, the following provider will add the path
2326
}
2427
}
2528

26-
To use the path provider you must register it in the **DIC** and add the
29+
To use the path provider you must register it in the container and add the
2730
``cmf_routing_auto.provider`` tag and set the **alias** accordingly:
2831

2932
.. configuration-block::
@@ -95,8 +98,8 @@ exception when a path already exists::
9598
}
9699
}
97100

98-
The ``init()`` method checks if the required options exists and saves the options
99-
in property. The ``execute()`` method executes the action.
101+
The ``init()`` method configures the provider (throwing errors when required
102+
options do not exists) and the ``execute()`` method executes the action.
100103

101104
It is registered in the DI configuration as follows:
102105

@@ -135,9 +138,11 @@ Note the following:
135138
* **Scope**: Must *always* be set to *prototype*;
136139
* **Tag**: The tag registers the service with the auto routing system, it can
137140
be one of the following:
141+
138142
* ``cmf_routing_auto.exists.action`` - if the action is to be used when a
139143
path exists;
140144
* ``cmf_routing_auto.not_exists.action`` - if the action is to be used when
141145
a path does not exist;
146+
142147
* **Alias**: The alias of the tag is the name by which you will reference this
143148
action in the auto routing configuration.

bundles/routing_auto/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ RoutingAutoBundle
55
:maxdepth: 2
66

77
introduction
8+
providers
9+
exists_actions
10+
not_exists_actions
11+
customization

bundles/routing_auto/introduction.rst

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
RoutingAutoBundle
66
=================
77

8-
.. include:: _not-stable-caution.rst.inc
9-
108
The RoutingAutoBundle allows you to define automatically created routes for
119
documents.
1210

11+
.. include:: ../_not-stable-caution.rst.inc
12+
1313
This implies a separation of the ``Route`` and ``Content`` documents. If your
1414
needs are simple this bundle may not be for you and you should have a look at
15-
:doc:`the SimpleCmsBundle <simple_cms/introduction>`.
15+
:doc:`the SimpleCmsBundle <../simple_cms/introduction>`.
1616

1717
Installation
1818
------------
@@ -24,13 +24,14 @@ Features
2424
--------
2525

2626
Imagine you are going to create a forum application that has two routeable
27-
contents, a category and the topics for that forum. These documents are called
27+
content documents - a category and the topics. These documents are called
2828
``Category`` and ``Topic``, and they are called *content documents*.
2929

30-
If you create a new category with the title "My New Category", the RoutingAutoBundle
31-
automatically create the route ``/forum/my-new-cateogry``. For each new ``Topic``
32-
it could create a route like ``/forum/my-new-category/my-topic-title``. This URL
33-
resolves to a special type of route that is called an *auto route*.
30+
If you create a new category with the title "My New Category", the
31+
RoutingAutoBundle will automatically create the route
32+
``/forum/my-new-cateogry``. For each new ``Topic`` it could create a route
33+
like ``/forum/my-new-category/my-new-topic``. This URL resolves to a special
34+
type of route that is called an *auto route*.
3435

3536
By default, when you update a content document that has an auto route, the
3637
corresponding auto route will also be updated. When deleting a content
@@ -70,25 +71,23 @@ Usage
7071
The diagram below shows a fictional URL for a forum topic. The first 6 elements
7172
of the URL are called the *content path*. The last element is called the *content name*.
7273

73-
-- TODO update this image!!
74+
.. image:: ../../_images/bundles/routing_auto_post_schema.png
7475

75-
.. image:: ../_images/bundles/routing_auto_post_schema.png
76-
77-
The content path is further broken down into *route stacks* and *routes*. A
78-
route stack is a group of routes and routes are simply documents in the PHPCR
79-
tree.
76+
The content path is further broken down into *path units* and *path elements*. A
77+
path unit is a group of path elements and path elements are simply documents
78+
in the PHPCR tree.
8079

8180
.. note::
8281

83-
Although routes can be of any document class in this case, only objects
84-
which extend the :class:`Symfony\\Component\\Routing\\Route` object will
85-
be considered when matching a URL.
82+
Although path elements can be of any document class in this case, only
83+
objects which extend the :class:`Symfony\\Component\\Routing\\Route`
84+
object will be considered when matching a URL.
8685

8786
The default behavior is to use ``Generic`` documents when generating a content
8887
path, and these documents will result in a 404 when accessed directly.
8988

90-
Internally, each route stack is built up by a *builder unit*. Builder units
91-
contain one *path provider* class and two actions classes one action to take
89+
Internally, each path unit is built up by a *builder unit*. Builder units
90+
contain one *path provider* class and two actions classes - one action to take
9291
if the provided path exists in the PHPCR tree, the other if it does not. The
9392
goal of each builder unit is to generate a path and then provide a route
9493
object for each element in that path.
@@ -105,25 +104,19 @@ The configuration for the example above could be as follows:
105104
106105
Acme\ForumBundle\Document\Topic
107106
content_path:
108-
# corresponds first route stack in diagram: my-forum
107+
# corresponds first path unit in diagram: my-forum
109108
forum_path:
110109
provider: [specified, { path: my-form }]
111110
exists_action: use
112111
not_exists_action: create
113112
114-
# corresponds second route stack in diagram: my-category
113+
# corresponds second path unit in diagram: my-category
115114
category_path:
116115
provider: [content_object, { method: getCategory }]
117116
exists_action: use
118117
not_exists_action: throw_exception
119118
120-
# corresponds third route stack in diagram: 2013/04/06
121-
date:
122-
provider: [content_datetime, { method: getPublishedDate } ]
123-
exists_action: use
124-
not_exists_action: create
125-
126-
# corresponds to the content name: my-topic-title
119+
# corresponds to the content name: my-new-topic
127120
content_name:
128121
provider: [content_method, { method: getTitle }]
129122
exists_action: [auto_increment, { pattern: -%d }]
@@ -140,32 +133,25 @@ The configuration for the example above could be as follows:
140133
<mapping class="Acme\ForumBundle\Document\Topic">
141134
142135
<content-path>
143-
<!-- corresponds first route stack in diagram: my-forum -->
136+
<!-- corresponds first path unit in diagram: my-forum -->
144137
<path-unit name="forum_path">
145138
<provider name="specified">
146139
<option name="path" value="my-forum" />
147140
</provider>
148141
</path-unit>
149142
150-
<!-- corresponds second route stack in diagram: my-category -->
143+
<!-- corresponds second path unit in diagram: my-category -->
151144
<path-unit name="category_path">
152145
<provider name="content_object">
153146
<option name="method" value="getCategory" />
154147
</provider>
155148
<exists-action strategy="use" />
156149
<not-exists-action strategy="throw_exception" />
157150
</path-unit>
158-
159-
<!-- corresponds third route stack in diagram: 2013/04/06 -->
160-
<path-unit name="date">
161-
<provider name="content_datetime">
162-
<option name="method" value="getPublishedDate" />
163-
</provider>
164-
</path-unit>
165151
</content-path>
166152
167153
168-
<!-- corresponds to the content name: my-topic-title -->
154+
<!-- corresponds to the content name: my-new-topic -->
169155
<content-name>
170156
<provider name="content_method">
171157
<option name="method" value="getTitle" />
@@ -186,7 +172,7 @@ The configuration for the example above could be as follows:
186172
'mappings' => array(
187173
'Acme\ForumBundle\Document\Topic' => array(
188174
'content_path' => array(
189-
// corresponds first route stack in diagram: my-forum
175+
// corresponds first path unit in diagram: my-forum
190176
'forum_path' => array(
191177
'provider' => array('specified', array(
192178
'path' => 'my-forum',
@@ -195,26 +181,17 @@ The configuration for the example above could be as follows:
195181
'not_exists_action' => 'create',
196182
),
197183
198-
// corresponds second route stack in diagram: my-category
184+
// corresponds second path unit in diagram: my-category
199185
'category_path' => array(
200186
'provider' => array('content_object', array(
201187
'method' => 'getCategory',
202188
)),
203189
'exists_action' => 'use',
204190
'not_exists_action' => 'throw_exception',
205191
),
206-
207-
// corresponds third route stack in diagram: 2013/04/06
208-
'date' => array(
209-
'provider' => array('content_datetime', array(
210-
'method' => 'getPublishedDate',
211-
)),
212-
'exists_action' => 'use',
213-
'not_exists_action' => 'create',
214-
),
215192
),
216193
217-
// corresponds to the content name: my-topic-title
194+
// corresponds to the content name: my-new-topic
218195
'content_name' => array(
219196
'provider' => array('content_method', array(
220197
'method' => 'getTitle',

bundles/routing_auto/not_exists_actions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The ``create`` action will create the path.
3131
3232
.. note::
3333

34-
**Currently** all routes provided by the content path build units will be
34+
**Currently** all routes provided by the content path builder units will be
3535
created as ``Generic`` documents, whilst the content name route will be
3636
created as an ``AutoRoute`` document.
3737

cookbook/create_basic_cms_auto_routing.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Creating a Basic CMS Using the RoutingAutoBundle
88
This three part article will show you how to create a basic CMS from scratch
99
using the following bundles:
1010

11-
* :doc:`../bundles/routing_auto`;
11+
* :doc:`../bundles/routing_auto/index`;
1212
* :doc:`../bundles/phpcr_odm`;
1313
* :doc:`../bundles/menu/index`;
1414
* `SonataDoctrinePhpcrAdminBundle`_.
@@ -445,7 +445,8 @@ Part 2: Automatic Routing
445445

446446
The routes (URLs) to your content will be automatically created and updated
447447
using the RoutingAutoBundle. This bundle is powerful and somewhat complicated.
448-
For a full a full explanation refer to the `RoutingAutoBundle documentation`_.
448+
For a full a full explanation refer to the
449+
:doc:`RoutingAutoBundle documentation <../bundles/routing_auto/introduction>`.
449450

450451
In summary, you will configure the auto routing system to create a new auto
451452
routing document in the routing tree for every post or content created. The

0 commit comments

Comments
 (0)