mapConfig() public method

Triggers mapping process between semantic and internal configuration.
public mapConfig ( array $config, eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationMapperInterface | callable $mapper )
$config array Parsed semantic configuration
$mapper eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ConfigurationMapperInterface | callable Mapper to use. Can be either an instance of ConfigurationMapper or a callable. HookableConfigurationMapper can also be used. In this case, preMap() and postMap() will be also called respectively before and after the mapping loop. If $mapper is a callable, the same arguments as defined in the signature defined in ConfigurationMapper interface will be passed: `array $scopeSettings, $currentScope, ContextualizerInterface $contextualizer`
 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('slots.yml');
     $loader->load('default_settings.yml');
     if (isset($config['api_endpoint'])) {
         $container->setParameter('ez_recommendation.api_endpoint', $config['api_endpoint']);
     }
     if (isset($config['recommender']['api_endpoint'])) {
         $container->setParameter('ez_recommendation.recommender.api_endpoint', $config['recommender']['api_endpoint']);
     }
     if (isset($config['recommender']['consume_timeout'])) {
         $container->setParameter('ez_recommendation.recommender.consume_timeout', $config['recommender']['consume_timeout']);
     }
     if (isset($config['tracking']['script_url'])) {
         $container->setParameter('ez_recommendation.tracking.script_url', $config['tracking']['script_url']);
     }
     if (isset($config['tracking']['api_endpoint'])) {
         $container->setParameter('ez_recommendation.tracking.api_endpoint', $config['tracking']['api_endpoint']);
     }
     $processor = new ConfigurationProcessor($container, 'ez_recommendation');
     $processor->mapConfig($config, new ConfigurationMapper());
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $container->setParameter('ezpublish_legacy.enabled', $config['enabled']);
     if (!$config['enabled']) {
         return;
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     // Security services
     $loader->load('security.yml');
     $container->setParameter('ezpublish_legacy.root_dir', $config['root_dir']);
     // Templating
     $loader->load('templating.yml');
     // View
     $loader->load('view.yml');
     // IO Services
     $loader->load('io.yml');
     // SignalSlot settings
     $loader->load('slot.yml');
     // Default settings
     $loader->load('default_settings.yml');
     $processor = new ConfigurationProcessor($container, 'ezpublish_legacy');
     $processor->mapConfig($config, function (array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizerInterface) {
         if (isset($scopeSettings['templating']['view_layout'])) {
             $contextualizerInterface->setContextualParameter('view_default_layout', $currentScope, $scopeSettings['templating']['view_layout']);
         }
         if (isset($scopeSettings['templating']['module_layout'])) {
             $contextualizerInterface->setContextualParameter('module_default_layout', $currentScope, $scopeSettings['templating']['module_layout']);
         }
     });
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     $loader->load('default_settings.yml');
     $processor = new ConfigurationProcessor($container, 'ez_comments');
     $processor->mapConfig($config, new ConfigurationMapper());
 }
 /**
  * {@inheritDoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $configuration = $this->getConfiguration($configs, $container);
     // Note: this is where the transformation occurs
     $config = $this->processConfiguration($configuration, $configs);
     $loader->load('io.yml');
     $loader->load('default_settings.yml');
     // Map settings
     $processor = new ConfigurationProcessor($container, 'ez_io');
     $processor->mapConfig($config, function ($scopeSettings, $currentScope, ContextualizerInterface $contextualizer) {
         if (isset($scopeSettings['handler'])) {
             $contextualizer->setContextualParameter('handler', $currentScope, $scopeSettings['handler']);
         }
     });
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = $this->getConfiguration($configs, $container);
     $config = $this->processConfiguration($configuration, $configs);
     $coreFileLocator = new FileLocator(__DIR__ . '/../../lib/Resources/config');
     $coreLoader = new Loader\YamlFileLoader($container, $coreFileLocator);
     $coreLoader->load('services.yml');
     $fileLocator = new FileLocator(__DIR__ . '/../Resources/config');
     $loader = new Loader\YamlFileLoader($container, $fileLocator);
     $loader->load('services.yml');
     $processor = new ConfigurationProcessor($container, $this->getAlias());
     $processor->mapConfig($config, function ($scopeSettings, $currentScope, ContextualizerInterface $contextualizer) {
         foreach ($scopeSettings as $key => $value) {
             $contextualizer->setContextualParameter($key, $currentScope, $value);
         }
     });
 }
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $container->setParameter('ezpublish_legacy.enabled', $config['enabled']);
     if (!$config['enabled']) {
         return;
     }
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     // Security services
     $loader->load('security.yml');
     if (isset($config['root_dir'])) {
         $container->setParameter('ezpublish_legacy.root_dir', $config['root_dir']);
     }
     // Templating
     $loader->load('templating.yml');
     // View
     $loader->load('view.yml');
     // Fieldtype Services
     $loader->load('fieldtype_services.yml');
     // SignalSlot settings
     $loader->load('slot.yml');
     $loader->load('debug.yml');
     // Default settings
     $loader->load('default_settings.yml');
     $processor = new ConfigurationProcessor($container, 'ezpublish_legacy');
     $processor->mapConfig($config, function (array $scopeSettings, $currentScope, ContextualizerInterface $contextualizer) {
         if (isset($scopeSettings['templating']['view_layout'])) {
             $contextualizer->setContextualParameter('view_default_layout', $currentScope, $scopeSettings['templating']['view_layout']);
         }
         if (isset($scopeSettings['templating']['module_layout'])) {
             $contextualizer->setContextualParameter('module_default_layout', $currentScope, $scopeSettings['templating']['module_layout']);
         }
         if (isset($scopeSettings['legacy_mode'])) {
             $container = $contextualizer->getContainer();
             $container->setParameter("ezsettings.{$currentScope}.legacy_mode", $scopeSettings['legacy_mode']);
             $container->setParameter("ezsettings.{$currentScope}.url_alias_router", !$scopeSettings['legacy_mode']);
         }
     });
     // Define additional routes that are allowed with legacy_mode: true.
     if (isset($config['legacy_aware_routes'])) {
         $container->setParameter('ezpublish.default_router.legacy_aware_routes', array_merge($container->getParameter('ezpublish.default_router.legacy_aware_routes'), $config['legacy_aware_routes']));
     }
 }
 /**
  * Loads a specific configuration.
  *
  * @param mixed[] $configs An array of configuration values
  * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container A ContainerBuilder instance
  *
  * @throws \InvalidArgumentException When provided tag is not defined in this extension
  *
  * @api
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $configuration = $this->getConfiguration($configs, $container);
     // Note: this is where the transformation occurs
     $config = $this->processConfiguration($configuration, $configs);
     // Base services and services overrides
     $loader->load('services.yml');
     // Security services
     $loader->load('security.yml');
     // Default settings
     $loader->load('default_settings.yml');
     $this->registerRepositoriesConfiguration($config, $container);
     $this->registerSiteAccessConfiguration($config, $container);
     $this->registerImageMagickConfiguration($config, $container);
     $this->registerPageConfiguration($config, $container);
     // Routing
     $this->handleRouting($config, $container, $loader);
     // Public API loading
     $this->handleApiLoading($container, $loader);
     $this->handleTemplating($container, $loader);
     $this->handleSessionLoading($container, $loader);
     $this->handleCache($config, $container, $loader);
     $this->handleLocale($config, $container, $loader);
     $this->handleHelpers($config, $container, $loader);
     $this->handleImage($config, $container, $loader);
     // Map settings
     $processor = new ConfigurationProcessor($container, 'ezsettings');
     $processor->mapConfig($config, $this->configParser);
     if ($this->suggestionCollector->hasSuggestions()) {
         $message = '';
         $suggestionFormatter = new YamlSuggestionFormatter();
         foreach ($this->suggestionCollector->getSuggestions() as $suggestion) {
             $message .= $suggestionFormatter->format($suggestion) . "\n\n";
         }
         throw new InvalidArgumentException($message);
     }
     $this->handleSiteAccessesRelation($container);
 }
 public function testMapConfigHookableMapperObject()
 {
     $namespace = 'ez_test';
     $saNodeName = 'foo';
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $processor = new ConfigurationProcessor($container, $namespace, $saNodeName);
     $contextualizer = $processor->getContextualizer();
     $sa1Name = 'sa1';
     $sa2Name = 'sa2';
     $sa1Config = array('foo' => 'bar', 'hello' => 'world', 'an_integer' => 123, 'a_bool' => true);
     $sa2Config = array('foo' => 'bar2', 'hello' => 'universe', 'an_integer' => 456, 'a_bool' => false);
     $config = array('not_sa_aware' => 'blabla', $saNodeName => array('sa1' => $sa1Config, 'sa2' => $sa2Config));
     $mapper = $this->getMock('eZ\\Bundle\\EzPublishCoreBundle\\DependencyInjection\\Configuration\\SiteAccessAware\\HookableConfigurationMapperInterface');
     $mapper->expects($this->once())->method('preMap')->with($config, $contextualizer);
     $mapper->expects($this->once())->method('postMap')->with($config, $contextualizer);
     $mapper->expects($this->exactly(count($config[$saNodeName])))->method('mapConfig')->will($this->returnValueMap(array(array($sa1Config, $sa1Name, $contextualizer, null), array($sa2Config, $sa2Name, $contextualizer, null))));
     $processor->mapConfig($config, $mapper);
 }