General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Skip to end of metadata
Go to start of metadata

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 bundle semantic configuration can be a bit tedious if you maintain it in the main app/config/ezplatform.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 of being explicit. The idea is to use the imports statement in your main ezplatform.yml:

app/config/ezplatform.yml
templates_rules.yml, placed under Resources/config folder in AcmeTestBundle

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

The following example will show you how to implicitly load settings to configure eZ Platform kernel. Note that this is also valid for any bundle!

We assume here that you're aware of service container extensions.

Acme/TestBundle/DependencyInjection/AcmeTestExtension
AcmeTestBundle/Resources/config/template_rules.yml

Regarding performance

Service container extensions are called only when the container is being compiled, so there is nothing to worry about regarding performance.

Configuration loaded this way will be overridden by the main ezplatform.yml file.

 

 

4 Comments

  1. If I have 20 siteaccesses, one for each language, do I have to define the rules 20 times in the templates_rules.yml?

  2. No, you can simply create a group with the 20 siteaccesses and add the general definitions to the group

  3. Hi, regarding your warning about clearing the cache, i noticed in the eZ Publish Demo Bundle that they are adding another line which after my test relieves you from clearing the cache

    Code snippet

    link to the Dependency Injection Extension of eZ Publish Demo Bundle:
    https://github.com/ezsystems/DemoBundle/blob/master/DependencyInjection/eZDemoExtension.php

  4. Hi, according to my tests, if a configuration option is present both in the main ezpublish.yml config file and in an imported config file, it is the value present in the main config file that takes precedence, and not the opposite, and this is true for the manual and implicite ways.