On 01/14/2011 10:02 PM, Jeremy Mikola wrote:
Nils,

I did volunteer to take this on, but just had too busy a week to put
much time into it.  Per your earlier example:

     ext.config:
         foo.bar: 3

I don't think that's equivalent to:

     ext.config:
         foo:
             bar: 3

At least not in Yaml.  In the first example, the key is "foo.bar" and
just "foo" in the second.  I don't see how the first syntax could let
you override bar without disturbing a value parallel to bar.  What
extension were you looking at that processed configs in this format?
The example you gave was in Yaml, but have you considered how the
"x.y.z" format would work in XML or PHP?

The code in the pull request I linked to which I've seen in a number of bundles now maps $config["foo"]["bar"] to a parameter called "foo.bar" which can also be set through $config["foo.bar"] making the above possible in YAML even though YAML itself doesn't do that. But I've since come to realise that this might not be a sensible default, since most frequently you need to overwrite individual keys. Lukas suggested to make the default that only the last config is used at all by default which I think makes sense, because it's very simple and predictable. The merge method can then be overwritten to implement a more complex behaviour. To make writing a custom merge method easier I think the extension should still include functionality like the remap methods in the pull request.

As for the details of implementing this I think there should indeed by a configLoad method which receives exactly one parameter and a configMerge method which takes two configurations and merges them. Alternatively it could take an array of config arrays, but that makes things more complicated. The code calling configMerge would then check to see if that method is implemented and otherwise simply overwrite the previous configs with the newest one.

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to