This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
[RFC] Proposal for new configuration format. #38
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b2f92bb
Example configuration
dantleech 3f9ce77
Added Config test
wouterj 0c582f6
Refactored Configuration builder
wouterj 0107391
Implemented new config
wouterj 0ca343e
Removed options new in #37
wouterj 93cbf9f
Added XML support
wouterj 51ff3f6
Fixed tests
wouterj 1c444da
Added PHP config test
wouterj 4f87d68
Fixed composer and changed internal method name.
dantleech b5913df
fixed dependencies
wouterj df8395a
Removed rendundant code
wouterj b5a7272
Made path_units optional (Better Yaml, PHP support)
wouterj 00c599d
Fixed test
wouterj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
$container->loadFromExtension('cmf_routing_auto', array( | ||
'mappings' => array( | ||
'Acme\BasicCmsBundle\Document\Page' => array( | ||
'content_path' => 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'), | ||
), | ||
), | ||
), | ||
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmf_routing_auto: | ||
mappings: | ||
Acme\BasicCmsBundle\Document\Page: | ||
content_path: | ||
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 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.