The following recipe is valid for any type of settings supported by Symfony framework.
Use case
Usually, you develop your website using one or several custom bundles as this is a best practice. However, dealing with core bundles semantic configuration can be a bit tedious if you maintain it in the main ezpublish/config/ezpublish.yml
configuration file.
This recipe will show you how to import configuration from a bundle the manual way and the implicit way.
The manual way
This is the simplest way of doing and it has the advantage to be explicit. The idea is to use the imports
statement in your main ezpublish.yml
:
During the merge process, if the imported configuration files contain entries that are already defined in the main configuration file, they will override them.
Tip
If you want to import configuration for development use only, you can do so in your ezpublish_dev.yml
The implicit way
Compatible with eZ Publish 5.1+ / Symfony 2.2+ as it uses Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface
which is available as of Symfony 2.2 (more info on Symfony cookbook).
The following example will show you how to implicitly load settings to be configure eZ Publish kernel. Note that this is also valid for any bundle !
We assume here that you're aware of service container extensions.
Regarding performance
Service container extensions are called only when the container is being compiled, so there is nothing to worry about regarding performance.
In dev environment, each time you modify files loaded this way, you'll need to manually clear the cache as Symfony doesn't check modification time on them.
Loading configuration this way lets you override settings in your main ezpublish.yml
file.