eZPublishCommunityProject  2013.5
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser Class Reference

Provides helpers to deal with array settings. More...

+ Inheritance diagram for eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser:
+ Collaboration diagram for eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser:

Public Member Functions

 setBaseKey ($key)
 Sets the base key of this parser. More...
 
- Public Member Functions inherited from eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser
 addSemanticConfig (NodeBuilder $nodeBuilder)
 Adds semantic configuration definition. More...
 
 registerInternalConfig (array $config, ContainerBuilder $container)
 Translates parsed semantic config values from $config to internal key/value pairs. More...
 

Public Attributes

const MERGE_FROM_SECOND_LEVEL = 2
 With this option, AbstractParser::registerInternalConfigArray() will merge the hashes from the second level. More...
 
const UNIQUE = 1
 With this option, AbstractParser::registerInternalConfigArray() will call array_unique() at the end of the merge process. More...
 

Protected Member Functions

 getContainerParameter (ContainerBuilder $container, $id, $default=null)
 Returns the value under the $id in the $container. More...
 
 groupsArraySetting (array $groups, $id, array $config, $options=0)
 Merges setting array for a set of groups. More...
 
 registerGlobalConfigArray ($id, array $config, ContainerBuilder $container)
 Make sure settings array defined in "global" siteaccess are registered in the internal global scope. More...
 
 registerInternalConfigArray ($id, array $config, ContainerBuilder $container, $options=0)
 Registers the internal configuration. More...
 

Protected Attributes

 $baseKey = 'system'
 

Detailed Description

Provides helpers to deal with array settings.

This abstract class mainly provides the registerInternalConfigArray() method to properly merge and register array settings defined at in several scopes: $this->registerInternalConfigArray( 'key', $config, $container ); This method will look for the 'key' array in the configuration provided in $config and will merge the arrays from default, group, siteaccess and global scopes in the correct order to compute the value for each siteaccess.

Member Function Documentation

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::getContainerParameter ( ContainerBuilder  $container,
  $id,
  $default = null 
)
protected

Returns the value under the $id in the $container.

if the container does not known this $id, returns $default

Parameters
ContainerBuilder$container
string$id
mixed$default
Returns
mixed

Referenced by eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser\registerInternalConfigArray().

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::groupsArraySetting ( array  $groups,
  $id,
array  $config,
  $options = 0 
)
protected

Merges setting array for a set of groups.

Parameters
array$groupsarray of group name
string$idid of the setting array under ezpublish.<base_key>.<group_name>
array$configthe full configuration array
int$optionsonly self::MERGE_FROM_SECOND_LEVEL or self::UNIQUE are recognized
Returns
array

Referenced by eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser\registerInternalConfigArray().

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::registerGlobalConfigArray (   $id,
array  $config,
ContainerBuilder  $container 
)
protected

Make sure settings array defined in "global" siteaccess are registered in the internal global scope.

Parameters
string$id
array$config
ContainerBuilder$container

Referenced by eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser\registerInternalConfigArray().

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::registerInternalConfigArray (   $id,
array  $config,
ContainerBuilder  $container,
  $options = 0 
)
protected

Registers the internal configuration.

For array settings, we merge the arrays defined in scopes default, in the siteaccess groups, in the siteaccess itself and in the global scope. To calculate the precedence of siteaccess group, they are alphabetically sorted.

Parameters
string$idid of the setting array to register
array$configthe full configuration as an array
ContainerBuilder$container
int$optionsbit mask of options (
See Also
constants of this class)

Referenced by eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\Templates\registerInternalConfig(), eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\View\registerInternalConfig(), eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\Page\registerInternalConfig(), eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\Image\registerInternalConfig(), and eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\Common\registerInternalConfig().

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::setBaseKey (   $key)

Sets the base key of this parser.

Parameters
string$key

Member Data Documentation

const eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::MERGE_FROM_SECOND_LEVEL = 2

With this option, AbstractParser::registerInternalConfigArray() will merge the hashes from the second level.

For instance: array( 'full' => array( 1, 2, 3 ) ) and array( 'full' => array( 4, 5 ) ) will result in array( 'full' => array( 1, 2, 3, 4, 5 ) )

const eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\AbstractParser::UNIQUE = 1

With this option, AbstractParser::registerInternalConfigArray() will call array_unique() at the end of the merge process.

This will only work with normal arrays (ie not hashes) containing scalar values.


The documentation for this class was generated from the following file: