eZPublishCommunityProject  2013.9
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver Class Reference

This class will help you get settings for a specific scope. More...

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

Public Member Functions

 __construct (SiteAccess $siteAccess, array $groupsBySiteAccess, ContainerInterface $container, $defaultNamespace, $undefinedStrategy=self::UNDEFINED_STRATEGY_EXCEPTION)
 
 getDefaultNamespace ()
 
 getParameter ($paramName, $namespace=null, $scope=null)
 Returns value for $paramName, in $namespace. More...
 
 getUndefinedStrategy ()
 
 hasParameter ($paramName, $namespace=null, $scope=null)
 Checks if $paramName exists in $namespace. More...
 
 setDefaultNamespace ($defaultNamespace)
 Changes the default namespace to look parameter into. More...
 
 setUndefinedStrategy ($undefinedStrategy)
 Sets the strategy to use if an undefined parameter is being asked. More...
 

Public Attributes

const SCOPE_DEFAULT = 'default'
 
const SCOPE_GLOBAL = 'global'
 
const UNDEFINED_STRATEGY_EXCEPTION = 1
 
const UNDEFINED_STRATEGY_NULL = 2
 

Protected Attributes

 $container
 
 $defaultNamespace
 
 $groupsBySiteAccess
 
 $siteAccess
 
 $undefinedStrategy
 

Detailed Description

This class will help you get settings for a specific scope.

This is useful to get a setting for a specific siteaccess for example.

It will check the different scopes available for a given namespace to find the appropriate parameter. To work, the dynamic setting must comply internally to the following name format : "<namespace>.<scope>.parameter.name".

  • <namespace> is the namespace for your dynamic setting. Defaults to "ezsettings", but can be anything.
  • <scope> is basically the siteaccess name you want your parameter value to apply to. Can also be "global" for a global override. Another scope is used internally: "default". This is the generic fallback.

The resolve scope order is the following:

  1. "global"
  2. SiteAccess name
  3. "default"

Constructor & Destructor Documentation

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::__construct ( SiteAccess  $siteAccess,
array  $groupsBySiteAccess,
ContainerInterface  $container,
  $defaultNamespace,
  $undefinedStrategy = self::UNDEFINED_STRATEGY_EXCEPTION 
)
Parameters
\eZ\Publish\Core\MVC\Symfony\SiteAccess$siteAccess
array$groupsBySiteAccessSiteAccess groups, indexed by siteaccess.
\Symfony\Component\DependencyInjection\ContainerInterface$container
string$defaultNamespaceThe default namespace
int$undefinedStrategyStrategy to use when encountering undefined parameters. Must be one of

Member Function Documentation

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::getDefaultNamespace ( )
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::getParameter (   $paramName,
  $namespace = null,
  $scope = null 
)

Returns value for $paramName, in $namespace.

Parameters
string$paramNameThe parameter name, without $prefix and the current scope (i.e. siteaccess name).
string$namespaceNamespace for the parameter name. If null, the default namespace will be used.
string$scopeThe scope you need $paramName value for. It's typically the siteaccess name. If null, the current siteaccess name will be used.
Exceptions
\eZ\Publish\Core\MVC\Exception\ParameterNotFoundException
Returns
mixed

Implements eZ\Publish\Core\MVC\ConfigResolverInterface.

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::getUndefinedStrategy ( )
Returns
int
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::hasParameter (   $paramName,
  $namespace = null,
  $scope = null 
)

Checks if $paramName exists in $namespace.

Parameters
string$paramName
string$namespaceIf null, the default namespace should be used.
string$scopeThe scope you need $paramName value for. It's typically the siteaccess name. If null, the current siteaccess name will be used.
Returns
boolean

Implements eZ\Publish\Core\MVC\ConfigResolverInterface.

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::setDefaultNamespace (   $defaultNamespace)

Changes the default namespace to look parameter into.

Parameters
string$defaultNamespace

Implements eZ\Publish\Core\MVC\ConfigResolverInterface.

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::setUndefinedStrategy (   $undefinedStrategy)

Sets the strategy to use if an undefined parameter is being asked.

Can be one of:

Defaults to ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION.

Parameters
int$undefinedStrategy

Member Data Documentation

eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::$container
protected
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::$groupsBySiteAccess
protected
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::$siteAccess
protected
const eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION = 1
const eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver::UNDEFINED_STRATEGY_NULL = 2

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