|
1 | 1 | # [WIP] Symfony CMF Routing Auto Route Bundle [](http://travis-ci.org/symfony-cmf/RoutingExtraBundle)
|
2 | 2 |
|
3 |
| -This bundle automatically creates and manages routes for given persisted document classes. |
| 3 | +This bundle is a WIP to automatically creates and manages routes for configured persisted |
| 4 | +document classes. |
4 | 5 |
|
5 |
| -Use cases: |
| 6 | +## Example configuration |
6 | 7 |
|
7 |
| - * Blog posts: To be able to view a blog posts, blog posts must have a route which |
8 |
| - is appended to that of its parent, the blog. |
| 8 | +The following is the current functional test configuration: |
9 | 9 |
|
10 |
| - - When a Post is created an auto-route is automatically created. |
11 |
| - - When the Post is updated, the auto-route is updated. |
12 |
| - - When the Post is deleted, the auto-route is deleted. |
| 10 | + symfony_cmf_routing_auto_route: |
13 | 11 |
|
14 |
| -Restrictions: |
| 12 | + auto_route_definitions: |
| 13 | + |
| 14 | + ## |
| 15 | + # e.g. /cms/auto-route/blog/my-blogs-title |
| 16 | + Symfony\Cmf\Bundle\RoutingAutoRouteBundle\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 | + |
| 35 | + ## |
| 36 | + # e.g. /cms/auto-route/blog/my-blogs-title/2013-04-09/my-post-title |
| 37 | + Symfony\Cmf\Bundle\RoutingAutoRouteBundle\Tests\Functional\app\Document\Post: |
| 38 | + chain: |
| 39 | + |
| 40 | + # /cms/auto-route/blog/my-blogs-title |
| 41 | + blog_path: |
| 42 | + path_provider: |
| 43 | + name: specified |
| 44 | + from_method: getBlogRoutePath |
| 45 | + exists_action: |
| 46 | + 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: |
| 71 | + strategy: create |
| 72 | + |
| 73 | + |
| 74 | +## Restrictions: |
15 | 75 |
|
16 | 76 | * Only documents stored with PHPCR-ODM are supported.
|
17 | 77 | * You must have the RoutingExtraBundle installed.
|
| 78 | + |
| 79 | +## TODO |
| 80 | + |
| 81 | +There are lots of todos but these shouldn't be forgotten: |
| 82 | + |
| 83 | + * Bundle is actually called RoutingAutoBundle - code currently uses RoutingAutoRouteBundle |
| 84 | + * Change the Doctrine event subscriber to an event listener. |
| 85 | + |
0 commit comments