Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
   eZ Publish 4.x / legacy

eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Skip to end of metadata
Go to start of metadata

5.4 / 2014.11


Before 5.4, if one wanted to implement a service needing siteaccess-aware settings (e.g. language settings),
they needed to inject the whole ConfigResolver (ezpublish.config.resolver) and get the needed settings from it.

This was not very convenient nor explicit.
Goal of this feature is to allow developers to inject these dynamic settings explicitly from their service definition (yml, xml, annotation...).



Static container parameters follows the %<parameter_name>% syntax in Symfony.

Dynamic parameters have the following: $<parameter_name>[; <namespace>[; <scope>]]$, default namespace being ezsettings,
and default scope being current siteaccess.

For more information, see ConfigResolver documentation.


This feature also introduces a DynamicSettingParser service that can be used for adding support of the dynamic settings syntax.
This service has ezpublish.config.dynamic_setting.parser for ID and implements


A few limitations still remain:

  • It is not possible to use dynamic settings in your semantic configuration (e.g. config.yml or ezpublish.ymlas they are meant primarily for parameter injection in services.
  • It is not possible to define an array of options having dynamic settings. They will not be parsed. Workaround is to use separate arguments/setters.
  • Injecting dynamic settings in request listeners is not recommended, as it won't be resolved with the correct scope (request listeners are instantiated before SiteAccess match). Workaround is to inject the ConfigResolver instead, and resolving the your setting in your onKernelRequest method (or equivalent).


Injecting an eZ parameter

Defining a simple service needing languages parameter (i.e. prioritized languages).


Internally, languages parameter is defined as ezsettings.<siteaccess_name>.languages, ezsettings being eZ internal namespace.

Before 5.4

After, with setter injection (preferred)



Important: Ensure you always add null as a default value, especially if the argument is type-hinted.

After, with constructor injection






Setter injection for dynamic settings should always be preferred, as it makes it possible to update your services that depend on them when ConfigResolver is updating its scope (e.g. when previewing content in a given SiteAccess). However, only one dynamic setting should be injected by setter.

Constructor injection will make your service be reset in that case.

Injecting 3rd party parameters