The Basics
Info | ||
---|---|---|
| ||
Configuration is tightly related to the service container. To fully understand the following, you need to be aware of Symfony's service container configuration. |
Basic configuration handling in eZ Publish is similar to what is commonly possible with Symfony. In this regard, you can define key/value pairs in your configuration files, under the parameters key (like in parameters.yml).
Internally, keys usually follow a dot syntax and values can be anything, including arrays and deep hashes. Usually keys are prefixed by a namespace corresponding to your application.
Info |
---|
eZ Publish core configuration is prefixed by ezsettings namespace. |
Example
Code Block | ||
---|---|---|
| ||
parameters:
myapp.parameter.name: someValue
myapp.boolean.param: true
myapp.some.hash:
foo: bar
an_array: [apple, banana, pear] |
Code Block | ||||
---|---|---|---|---|
| ||||
// Inside a controller
$myParameter = $this->container->getParameter( 'myapp.parameter.name' ); |
Dynamic configuration
In eZ Publish, it is fairly common to have different settings depending on the current siteaccess (e.g. languages, content view provider configuration...).
Scope
Dynamic configuration can be resolved 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.
This mechanism is not limited to eZ Publish internal settings (aka ezsettings namespace) and is applicable for specific needs (bundle related, project related...).
How it works
Dynamic configuration is handled by a config resolver. It consists in an object exposing mainly hasParameter() and getParameter() methods.
Children Display | ||
---|---|---|
|