ezsystems/ezp-next — pull request #62 by lolautruche (2012-09-06 17:29:35+00:00)
Title: Dynamic configuration handling

This PR introduces a mechanism to resolve **dynamic configuration**, depending on a scope.

Available scopes are (in order of check) :
1. *global*
2. SiteAccess
3. *default*

It gives the opportunity to define settings for a given siteaccess for instance, like the legacy INI override system.

The mechanism is not limited to eZ Publish internal settings (aka ***ezsettings* namespace**) and is applicable for specific needs (bundle related, project related...).

## Example
Considering the following configuration:

```yaml
parameters:
# default settings, empty
ezsettings.default.location_view: {}

# Settings for ezdemo_site siteaccess scope
ezsettings.ezdemo_site.location_view:
full:
smallFolder:
template: eZDemoBundle:full:small_folder.html.twig
match:
Identifier\ContentType: [small_folder]
Identifier\ParentContentType: [landing_page, frontpage]
```

You can use the following code within a controller:

```php
container->get( 'ezpublish.config.resolver' );
// The following will resolve ezsettings..location_view
// In the case of ezdemo_site, will return the configured hash above.
// Otherwise it will return the value for ezsettings.default.location_view (empty hash)
$locationViewSetting = $configResolver->getParameter( 'location_view' );
```

> Note: that if a `ezsettings.global.location_view` was defined, it would have been selected instead of `ezsettings.ezdemo_site.location_view`.

A second parameter can be added to `getParameter()` method, the *namespace* (defaults to **ezsettings**).

This can apply to **any** setting.

Note that unit tests are still a WIP.