private function addComplexParametersDependencies($parameter, $scope, ContainerBuilder $container)
{
// The complex setting exists in this scope, we don't need to do anything
if ($container->hasParameter("ezsettings.{$scope}.{$parameter}")) {
return;
}
$parameterValue = $container->getParameter("ezsettings.default.{$parameter}");
// not complex in this scope
if (!$this->complexSettingParser->containsDynamicSettings($parameterValue)) {
return;
}
// if one of the complex parameters dependencies is set in the current scope,
// we set the complex parameter in the current scope as well.
foreach ($this->complexSettingParser->parseComplexSetting($parameterValue) as $dynamicParameter) {
$dynamicParameterParts = $this->complexSettingParser->parseDynamicSetting($dynamicParameter);
if ($dynamicParameterParts['scope'] === $scope) {
continue;
}
$dynamicParameterId = sprintf('%s.%s.%s', $dynamicParameterParts['namespace'] ?: 'ezsettings', $scope, $dynamicParameterParts['param']);
if ($container->hasParameter($dynamicParameterId)) {
$container->setParameter("ezsettings.{$scope}.{$parameter}", $parameterValue);
break;
}
}
}