PHP Class eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver

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 : "..parameter.name". - is the namespace for your dynamic setting. Defaults to "ezsettings", but can be anything. - 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"
Inheritance: implements eZ\Publish\Core\MVC\Symfony\Configuration\VersatileScopeInterface, implements eZ\Publish\Core\MVC\Symfony\SiteAccess\SiteAccessAware, implements Symfony\Component\DependencyInjection\ContainerAwareInterface, use trait Symfony\Component\DependencyInjection\ContainerAwareTrait
显示文件 Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$defaultNamespace string
$defaultScope string
$groupsBySiteAccess Siteaccess groups, indexed by siteaccess name
$siteAccess eZ\Publish\Core\MVC\Symfony\SiteAccess
$undefinedStrategy integer

Public Methods

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

Method Details

__construct() public method

public __construct ( array $groupsBySiteAccess, string $defaultNamespace, integer $undefinedStrategy = self::UNDEFINED_STRATEGY_EXCEPTION )
$groupsBySiteAccess array SiteAccess groups, indexed by siteaccess.
$defaultNamespace string The default namespace
$undefinedStrategy integer Strategy to use when encountering undefined parameters. Must be one of - ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION (throw an exception) - ConfigResolver::UNDEFINED_STRATEGY_NULL (return null)

getDefaultNamespace() public method

public getDefaultNamespace ( ) : string
return string

getDefaultScope() public method

public getDefaultScope ( )

getParameter() public method

Returns value for $paramName, in $namespace.
public getParameter ( string $paramName, string $namespace = null, string $scope = null ) : mixed
$paramName string The parameter name, without $prefix and the current scope (i.e. siteaccess name).
$namespace string Namespace for the parameter name. If null, the default namespace will be used.
$scope string The scope you need $paramName value for. It's typically the siteaccess name. If null, the current siteaccess name will be used.
return mixed

getUndefinedStrategy() public method

public getUndefinedStrategy ( ) : integer
return integer

hasParameter() public method

Checks if $paramName exists in $namespace.
public hasParameter ( string $paramName, string $namespace = null, string $scope = null ) : boolean
$paramName string
$namespace string If null, the default namespace should be used.
$scope string The scope you need $paramName value for. It's typically the siteaccess name. If null, the current siteaccess name will be used.
return boolean

setDefaultNamespace() public method

Changes the default namespace to look parameter into.
public setDefaultNamespace ( string $defaultNamespace )
$defaultNamespace string

setDefaultScope() public method

public setDefaultScope ( $scope )

setSiteAccess() public method

public setSiteAccess ( SiteAccess $siteAccess = null )
$siteAccess eZ\Publish\Core\MVC\Symfony\SiteAccess

setUndefinedStrategy() public method

Can be one of: - ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION (throw an exception) - ConfigResolver::UNDEFINED_STRATEGY_NULL (return null). Defaults to ConfigResolver::UNDEFINED_STRATEGY_EXCEPTION.
public setUndefinedStrategy ( integer $undefinedStrategy )
$undefinedStrategy integer

Property Details

$defaultNamespace protected_oe property

protected string $defaultNamespace
return string

$defaultScope protected_oe property

protected string $defaultScope
return string

$groupsBySiteAccess protected_oe property

Siteaccess groups, indexed by siteaccess name
protected $groupsBySiteAccess

$siteAccess protected_oe property

protected SiteAccess,eZ\Publish\Core\MVC\Symfony $siteAccess
return eZ\Publish\Core\MVC\Symfony\SiteAccess

$undefinedStrategy protected_oe property

protected int $undefinedStrategy
return integer