Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

[RFC] Proposal for new configuration format. #38

Closed
wants to merge 13 commits into from

Conversation

dantleech
Copy link
Member

No description provided.

strategy: use
not_exists_action:
strategy: create
provider: [ specified, { path: test/auto-route } ]
Copy link
Member

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.

Copy link
Member Author

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 } }

Copy link
Member

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?

@dbu
Copy link
Member

dbu commented Nov 17, 2013

i am +1 on this, looks really nice and more compact. and quite expressive.

##
- auto_increment
-
pattern: -%d
Copy link
Member

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?

Copy link
Member Author

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.

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

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.

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

Are we also going to fix the XML issues with the current configuration? If so, there are currently 2 things to discuss:

  • The auto_route_mapping node needs a fixXmlConfig in order to work. This means we should rename it to auto_route_mappings (plural version), what do you think about this?
  • Using multiple content-path elements is not nice, do you agree with using builder-unit elements in XML? Should we also do this in Yaml, or do we want to use some beforeNormalization to not include this in the Yaml and PHP format?

@dbu
Copy link
Member

dbu commented Nov 18, 2013

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.

@dantleech
Copy link
Member Author

That looks perfect. For auto_route_mappings I think changing it rather to mapping(s) is better. For plurality - what do the other bundles do?

builder-unit does not really say much -- its more a term used in the code.

<path_unit ...>
<path_name ...>

What would that look like?

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

For plurality - what do the other bundles do?

It's just required and almost all bundles use it, afaik.

What would that look like?

I think I prefer <path-unit>.

although we should not have too many different options for the same thing. one short and one long should be enough imh

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.

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

OK, I've now finished this PR with tests for PHP and XML support. Wdyt?

@dbu
Copy link
Member

dbu commented Nov 18, 2013

+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 :-)

@dantleech
Copy link
Member Author

Yeah looks good :) For this to be RC I think it needs #33 and #37 -- the multilang depends on that PHPCR-ODM issue with translation loading from memory ...

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

rebased it

I can't see why we need to mere #33 before merging this one? And for #37, I think it's better to merge this one first and then update that PR.

@wouterj wouterj mentioned this pull request Nov 18, 2013
@dantleech
Copy link
Member Author

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.

@dbu
Copy link
Member

dbu commented Nov 18, 2013

a tag like 0.9 ? would make sense for people depending on this.

@dbu
Copy link
Member

dbu commented Nov 18, 2013

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...

@dantleech
Copy link
Member Author

The tests seem to be broken...

->useAttributeAsKey('name')
->prototype('array')
->children()
->append($this->getUnitConfigOption('provider', 'name'))
Copy link
Member Author

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.

@wouterj
Copy link
Member

wouterj commented Nov 18, 2013

@dantleech tests should pass now

mappings:
Acme\BasicCmsBundle\Document\Page:
content_path:
path_units:
Copy link
Member Author

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: ... } ] }

Copy link
Member

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.

@dantleech
Copy link
Member Author

There is a single test fail about "path_units" -- otherwise is this ready to go?

@wouterj
Copy link
Member

wouterj commented Nov 24, 2013

@dantleech it should be fixed now

@dantleech
Copy link
Member Author

@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 :)

@wouterj
Copy link
Member

wouterj commented Nov 24, 2013

@wouterj
Copy link
Member

wouterj commented Dec 8, 2013

ping @dantleech

@dantleech dantleech closed this in f843523 Dec 8, 2013
@wouterj wouterj deleted the configuration_proposal branch December 8, 2013 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants