|
1 |
| -# [WIP] Symfony CMF Routing Auto Route Bundle [](http://travis-ci.org/symfony-cmf/RoutingExtraBundle) |
| 1 | +# [WIP] Symfony CMF Routing Auto Route Bundle [](http://travis-ci.org/symfony-cmf/RoutingAutoBundle) |
2 | 2 |
|
3 |
| -This bundle is a WIP to automatically creates and manages routes for configured persisted |
| 3 | +This bundle is a WIP which automatically creates and manages routes for configured persisted |
4 | 4 | document classes.
|
5 | 5 |
|
| 6 | +See the [official documentation](http://symfony.com/doc/master/cmf/bundles/routing-auto.html) |
| 7 | + |
6 | 8 | ## Example configuration
|
7 | 9 |
|
8 | 10 | The following is the current functional test configuration:
|
9 | 11 |
|
10 |
| - symfony_cmf_routing_auto_route: |
| 12 | + symfony_cmf_routing_auto: |
11 | 13 |
|
12 |
| - auto_route_definitions: |
| 14 | + auto_route_mapping: |
13 | 15 |
|
14 | 16 | ##
|
15 | 17 | # e.g. /cms/auto-route/blog/my-blogs-title
|
16 | 18 | Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Functional\app\Document\Blog:
|
17 |
| - chain: |
18 |
| - base: |
19 |
| - path_provider: |
20 |
| - name: specified |
21 |
| - path: /cms/auto-route/blog |
22 |
| - exists_action: |
23 |
| - strategy: use |
24 |
| - not_exists_action: |
25 |
| - strategy: create |
26 |
| - blog_title: |
27 |
| - path_provider: |
28 |
| - name: from_object_method |
29 |
| - method: getTitle |
30 |
| - exists_action: |
31 |
| - strategy: auto_increment |
32 |
| - not_exists_action: |
33 |
| - strategy: create |
34 | 19 |
|
35 |
| - ## |
36 |
| - # e.g. /cms/auto-route/blog/my-blogs-title/2013-04-09/my-post-title |
37 |
| - Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Functional\app\Document\Post: |
38 |
| - chain: |
39 |
| - |
40 |
| - # /cms/auto-route/blog/my-blogs-title |
41 |
| - blog_path: |
42 |
| - path_provider: |
| 20 | + # generate or use path components leading up to the final part of the path |
| 21 | + content_path: |
| 22 | + base: |
| 23 | + provider: |
43 | 24 | name: specified
|
44 |
| - from_method: getBlogRoutePath |
45 |
| - exists_action: |
| 25 | + path: /test/auto-route/blog |
| 26 | + exists_action: |
46 | 27 | strategy: use
|
47 |
| - not_exists_action: |
48 |
| - strategy: throw_exception |
49 |
| - |
50 |
| - # 2013-04-09 |
51 |
| - date: |
52 |
| - path_provider: |
53 |
| - name: date |
54 |
| - format: yyyy-mm-dd |
55 |
| - from_method: getPublishedAt |
56 |
| - exists_action: |
57 |
| - strategy: use |
58 |
| - not_exists_action: |
59 |
| - strategy: create |
60 |
| - |
61 |
| - # my-post-title |
62 |
| - post_title: |
63 |
| - path_provider: |
64 |
| - name: slugify_object_method |
65 |
| - from_method: getTitle |
66 |
| - slugfier: symfony_cmf_routing_auto_route.default_slugifier |
67 |
| - exists_action: |
68 |
| - strategy: auto_increment |
69 |
| - pattern: -%d |
70 |
| - not_exists_action: |
| 28 | + not_exists_action: |
71 | 29 | strategy: create
|
72 |
| - |
| 30 | + patcher: generic |
| 31 | + |
| 32 | + content_name: |
| 33 | + provider: |
| 34 | + name: from_object_method |
| 35 | + method: getTitle |
| 36 | + exists_action: |
| 37 | + strategy: auto_increment |
| 38 | + pattern: -%d |
| 39 | + not_exists_action: |
| 40 | + strategy: create |
73 | 41 |
|
74 | 42 | ## Restrictions:
|
75 | 43 |
|
76 | 44 | * Only documents stored with PHPCR-ODM are supported.
|
77 | 45 | * You must have the RoutingExtraBundle installed.
|
| 46 | + |
| 47 | +## Installation |
| 48 | + |
| 49 | +Add a requirement for ``symfony-cmf/routing-auto-bundle`` to your |
| 50 | +composer.json and instantiate the bundle in your AppKernel.php |
| 51 | + |
| 52 | + new Symfony\Cmf\Bundle\RoutingAutoBundle\SymfonyCmfRoutingAutoBundle() |
0 commit comments