-
Notifications
You must be signed in to change notification settings - Fork 29
[RFC] Proposal for new configuration format. #38
Changes from 9 commits
b2f92bb
3f9ce77
0c582f6
0107391
0ca343e
93cbf9f
51ff3f6
1c444da
4f87d68
b5913df
df8395a
b5a7272
00c599d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('cmf_routing_auto', array( | ||
'mappings' => array( | ||
'Acme\BasicCmsBundle\Document\Page' => array( | ||
'content_path' => array( | ||
'path_units' => array( | ||
'pages' => array( | ||
'provider' => array('specified', array('path' => '/cms/routes/page')), | ||
'exists_action' => 'use', | ||
'not_exists_action' => array( | ||
'strategy' => 'create', | ||
), | ||
), | ||
), | ||
), | ||
'content_name' => array( | ||
'provider' => array('content_method', array('method' => 'getTitle')), | ||
'exists_action' => array( | ||
'strategy' => 'auto_increment', | ||
'options' => array( | ||
'pattern' => '-%d', | ||
), | ||
), | ||
'not_exists_action' => array('create'), | ||
), | ||
), | ||
), | ||
)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<container xmlns="http://symfony.com/schema/dic/services"> | ||
|
||
<config xmlns="http://cmf.symfony.com/schema/dic/routing_auto"> | ||
|
||
<mapping class="Acme\BasicCmsBundle\Document\Page"> | ||
|
||
<content-path> | ||
<path-unit name="pages"> | ||
<provider name="specified"> | ||
<option name="path" value="/cms/routes/page" /> | ||
</provider> | ||
<exists-action strategy="use" /> | ||
<not-exists-action strategy="create" /> | ||
</path-unit> | ||
</content-path> | ||
|
||
<content-name> | ||
<provider name="content_method"> | ||
<option name="method" value="getTitle" /> | ||
</provider> | ||
<exists-action strategy="auto_increment"> | ||
<option name="pattern" value="-%d" /> | ||
</exists-action> | ||
<not-exists-action strategy="create" /> | ||
</content-name> | ||
</mapping> | ||
</config> | ||
</container> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmf_routing_auto: | ||
mappings: | ||
Acme\BasicCmsBundle\Document\Page: | ||
content_path: | ||
path_units: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure I like this key, it is redundant. The content_path should already be a collection of "path-units". It also suggests that content_path:
pages: { provider: [ specified, { path: ... } ] }
foobar: { provider: [ specified, { path: ... } ] } There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made the |
||
pages: | ||
provider: [ specified, { path: /cms/routes/page } ] | ||
exists_action: use | ||
not_exists_action: | ||
strategy: create | ||
content_name: | ||
provider: [ content_method, { method: getTitle } ] | ||
exists_action: | ||
strategy: auto_increment | ||
options: | ||
pattern: -%d | ||
not_exists_action: [ create ] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,75 +15,51 @@ cmf_routing: | |
route_basepath: /test/routing | ||
|
||
cmf_routing_auto: | ||
|
||
auto_route_mapping: | ||
|
||
## | ||
mappings: | ||
# e.g. /cms/auto-route/blog/my-blogs-title | ||
Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Blog: | ||
|
||
# generate or use path components leading up to the final part of the path | ||
content_path: | ||
base: | ||
provider: | ||
name: specified | ||
path: test/auto-route | ||
exists_action: | ||
strategy: use | ||
not_exists_action: | ||
strategy: create | ||
namespace: | ||
provider: | ||
name: specified | ||
path: blog | ||
exists_action: | ||
strategy: use | ||
not_exists_action: | ||
strategy: create | ||
|
||
path_units: | ||
base: | ||
provider: [ specified, { path: test/auto-route } ] | ||
exists_action: use | ||
not_exists_action: create | ||
namespace: | ||
provider: [ specified, { path: blog } ] | ||
exists_action: use | ||
not_exists_action: create | ||
# using alternative syntax | ||
content_name: | ||
provider: | ||
name: content_method | ||
method: getTitle | ||
options: | ||
method: getTitle | ||
exists_action: | ||
strategy: auto_increment | ||
pattern: -%d | ||
not_exists_action: | ||
options: | ||
pattern: -%d | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the same as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just for getting an idea of what the configuration can look like when expanded. |
||
not_exists_action: | ||
strategy: create | ||
|
||
## | ||
# e.g. /cms/auto-route/blog/my-blogs-title/2013-04-09/my-post-title | ||
Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Post: | ||
|
||
content_path: | ||
|
||
# /cms/auto-route/blog/my-blogs-title | ||
blog_path: | ||
provider: | ||
name: content_object | ||
method: getBlog | ||
exists_action: | ||
strategy: use | ||
not_exists_action: | ||
strategy: throw_exception | ||
|
||
date: | ||
provider: | ||
name: content_datetime | ||
method: getDate | ||
date_format: Y/m/d | ||
exists_action: | ||
strategy: use | ||
not_exists_action: | ||
strategy: create | ||
|
||
path_units: | ||
# /cms/auto-route/blog/my-blogs-title | ||
blog_path: | ||
provider: [ content_object, { method: getBlog } ] | ||
exists_action: use | ||
not_exists_action: throw_exception | ||
date: | ||
provider: | ||
name: content_datetime | ||
options: | ||
method: getDate | ||
date_format: Y/m/d | ||
exists_action: use | ||
not_exists_action: create | ||
content_name: | ||
# my-post-title | ||
provider: | ||
name: content_method | ||
method: getTitle | ||
exists_action: | ||
strategy: auto_increment | ||
pattern: -%d | ||
not_exists_action: | ||
strategy: create | ||
provider: [ content_method, { method: getTitle } ] | ||
exists_action: [ auto_increment, { pattern: -%d } ] | ||
not_exists_action: [ create ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj I changed the name of this method to
BuilderUnitConfigOption
toUnitConfigOption
.. slightly more generic.