-
Notifications
You must be signed in to change notification settings - Fork 29
[RFC] Proposal for new configuration format. #38
Conversation
strategy: use | ||
not_exists_action: | ||
strategy: create | ||
provider: [ specified, { path: test/auto-route } ] |
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.
what is specified doing in this case? acting as a name for this? or is it a "type" of provider? if its defining the name, i prefer the previous format. if its defining the "type", i like this new compact format better.
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.
It is the name of the strategy to use.
Another (complimentary or alternative) syntax would be to use an associative array:
provider: { strategy: specified, options: { path: test/auto_route } }
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.
i like the succintctness of the short variant. but the other one looks good too. maybe more flexible in case we add additional things in some places. @wouterj wdyt?
i am +1 on this, looks really nice and more compact. and quite expressive. |
## | ||
- auto_increment | ||
- | ||
pattern: -%d |
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.
this is the same as [ auto_increment, { pattern: -%d } ]
isn't it? Why did you use this (ugly) format?
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.
This is just for getting an idea of what the configuration can look like when expanded.
ping @dantleech I've been working on this one. I've added tests for the config and implemented the config format. Currently many things are supported: # long version
provider:
name: content_method
options:
method: getTitle
# short version
provider: [ content_method, { method: getTitle } ]
# long version without options
exists_action:
strategy: use
# short version without options 1
exists_action: [ use ]
# short version without options 2
exists_action: use I've also removed the duplicated lines in the config tree and replaced them with the appending feature. |
Are we also going to fix the XML issues with the current configuration? If so, there are currently 2 things to discuss:
|
looking good, although we should not have too many different options for the same thing. one short and one long should be enough imho. for xml, i would vote to keep them as much as possible in sync. auto_route_mappings sounds semantically more correct to me. |
That looks perfect. For
<path_unit ...>
<path_name ...> What would that look like? |
It's just required and almost all bundles use it, afaik.
I think I prefer
Almost all versions are comming from the config component. The long version is required and when not providing options it just looks like the other long version. The short version is too nice to not include it and using it without any options looks a bit ugly to me, that's why I introduced only providing the name. I don't think it'll cause an issue, we just advocated using the short version and nobody will use the long version. |
OK, I've now finished this PR with tests for PHP and XML support. Wdyt? |
+1 , great stuff! it needs a merge of master branch and resolve conflicts it seems. now we "just" need to document this gem and make it follow the bundle standards to have it ready for the december release of the cmf :-) |
Sorry, not as a prerequisite for merging, but for a 1.0 version. Although, it might be a good idea to make a tag here as its a BC break. |
a tag like 0.9 ? would make sense for people depending on this. |
another option could be to call it 1.0 but with a big warning that BC is going to break. would be a good excuse to have the real thing be version 1.1 as the rest of the cmf... |
The tests seem to be broken... |
->useAttributeAsKey('name') | ||
->prototype('array') | ||
->children() | ||
->append($this->getUnitConfigOption('provider', 'name')) |
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
to UnitConfigOption
.. slightly more generic.
@dantleech tests should pass now |
mappings: | ||
Acme\BasicCmsBundle\Document\Page: | ||
content_path: | ||
path_units: |
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.
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_name
should have a path_unit
child.
content_path:
pages: { provider: [ specified, { path: ... } ] }
foobar: { provider: [ specified, { path: ... } ] }
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.
I made the path_units
child optional.
There is a single test fail about "path_units" -- otherwise is this ready to go? |
@dantleech it should be fixed now |
@wouterj could you update the documentation with the new format? I will then tag what we currently have as 0.9 or something and then merge this :) |
ping @dantleech |
No description provided.