getContainer() public method

public getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface
return Symfony\Component\DependencyInjection\ContainerInterface
Ejemplo n.º 1
0
 /**
  * Post process configuration to add io_root_dir and io_prefix.
  */
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $container = $contextualizer->getContainer();
     // complex parameters dependencies
     foreach (array_merge($config['siteaccess']['list'], array_keys($config['siteaccess']['groups'])) as $scope) {
         $this->addComplexParametersDependencies('io.url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.legacy_url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.root_dir', $scope, $container);
     }
     // we should only write for default, and for sa/sa groups/global IF they have a declared value
     $scopes = array_merge(array('default'), $config['siteaccess']['list'], array_keys($config['siteaccess']['groups']));
     foreach ($scopes as $scope) {
         // post process io.url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.url_prefix', $scope, $postProcessedValue);
         }
         // post process io.legacy_url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.legacy_url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.legacy_url_prefix', $scope, $postProcessedValue);
         }
         // post process io.root_dir for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.root_dir', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.root_dir', $scope, $postProcessedValue);
         }
     }
 }
Ejemplo n.º 2
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['database'])) {
         $this->addDatabaseConfigSuggestion($currentScope, $scopeSettings['database']);
     }
     if (isset($scopeSettings['repository'])) {
         $contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']);
     }
     if (isset($scopeSettings['legacy_mode'])) {
         $contextualizer->setContextualParameter('legacy_mode', $currentScope, $scopeSettings['legacy_mode']);
         $contextualizer->setContextualParameter('url_alias_router', $currentScope, !$scopeSettings['legacy_mode']);
     }
     if (isset($scopeSettings['cache_pool_name'])) {
         $contextualizer->setContextualParameter('cache_pool_name', $currentScope, $scopeSettings['cache_pool_name']);
     }
     if (isset($scopeSettings['var_dir'])) {
         $contextualizer->setContextualParameter('var_dir', $currentScope, $scopeSettings['var_dir']);
     }
     if (isset($scopeSettings['storage_dir'])) {
         $contextualizer->setContextualParameter('storage_dir', $currentScope, $scopeSettings['storage_dir']);
     }
     if (isset($scopeSettings['binary_dir'])) {
         $contextualizer->setContextualParameter('binary_dir', $currentScope, $scopeSettings['binary_dir']);
     }
     // session_name setting is deprecated in favor of session.name
     $container = $contextualizer->getContainer();
     $sessionOptions = $container->hasParameter("ezsettings.{$currentScope}.session") ? $container->getParameter("ezsettings.{$currentScope}.session") : array();
     if (isset($sessionOptions['name'])) {
         $contextualizer->setContextualParameter('session_name', $currentScope, $sessionOptions['name']);
     }
     // @deprecated session_name is deprecated, but if present, in addition to session.name, consider it instead (BC).
     if (isset($scopeSettings['session_name'])) {
         $sessionOptions['name'] = $scopeSettings['session_name'];
         $contextualizer->setContextualParameter('session_name', $currentScope, $scopeSettings['session_name']);
         $contextualizer->setContextualParameter('session', $currentScope, $sessionOptions);
     }
     if (isset($scopeSettings['http_cache']['purge_servers'])) {
         $contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']);
     }
     if (isset($scopeSettings['anonymous_user_id'])) {
         $contextualizer->setContextualParameter('anonymous_user_id', $currentScope, $scopeSettings['anonymous_user_id']);
     }
     if (isset($scopeSettings['user']['layout'])) {
         $contextualizer->setContextualParameter('security.base_layout', $currentScope, $scopeSettings['user']['layout']);
     }
     if (isset($scopeSettings['user']['login_template'])) {
         $contextualizer->setContextualParameter('security.login_template', $currentScope, $scopeSettings['user']['login_template']);
     }
     if (isset($scopeSettings['index_page'])) {
         $contextualizer->setContextualParameter('index_page', $currentScope, $scopeSettings['index_page']);
     }
     if (isset($scopeSettings['default_page'])) {
         $contextualizer->setContextualParameter('default_page', $currentScope, '/' . ltrim($scopeSettings['default_page'], '/'));
     }
 }
Ejemplo n.º 3
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     $container = $contextualizer->getContainer();
     $defaultConfig = array('layouts' => $container->getParameter('ezpublish.ezpage.layouts'), 'blocks' => $container->getParameter('ezpublish.ezpage.blocks'), 'enabledLayouts' => $container->getParameter('ezpublish.ezpage.enabledLayouts'), 'enabledBlocks' => $container->getParameter('ezpublish.ezpage.enabledBlocks'));
     $container->setParameter('ezsettings.' . ConfigResolver::SCOPE_DEFAULT . '.ezpage', $defaultConfig);
     $contextualizer->mapConfigArray('ezpage', $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL);
     // filters blocks and layouts for each siteaccess to keep only
     // the enabled ones for this sa
     foreach ($config['siteaccess']['list'] as $sa) {
         $ezpageSettings = $container->getParameter("ezsettings.{$sa}.ezpage");
         foreach (array('layouts', 'blocks') as $type) {
             $enabledKey = 'enabled' . ucfirst($type);
             if (empty($ezpageSettings[$enabledKey])) {
                 $ezpageSettings[$type] = array();
                 continue;
             }
             $ezpageSettings[$type] = array_intersect_key($ezpageSettings[$type], array_flip($ezpageSettings[$enabledKey]));
             $ezpageSettings[$enabledKey] = array_unique($ezpageSettings[$enabledKey]);
         }
         $container->setParameter("ezsettings.{$sa}.ezpage", $ezpageSettings);
     }
 }
Ejemplo n.º 4
0
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $contextualizer->getContainer()->setParameter('ezpublish.siteaccesses_by_language', $this->siteAccessesByLanguages);
 }