Пример #1
0
 /**
  * @see Symfony\Component\DependencyInjection\Extension.ExtensionInterface::load()
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // set an array full of the driver classes
     $container->setParameter('winzou_cache.internal.drivers', $config['driver']);
     // Case sensitive
     $config['options']['default_driver'] = strtolower($config['options']['default_driver']);
     // we check if the default_driver value is ok
     if (!isset($config['driver'][$config['options']['default_driver']])) {
         throw new \InvalidArgumentException('The parameter winzou_book.options.default_driver[value="' . $config['options']['default_driver'] . '"] is invalid.');
     }
     $config['internal']['default_driver_class'] = $config['driver'][$config['options']['default_driver']];
     $this->bindParameter($container, 'winzou_cache', $config);
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }
Пример #2
0
 /**
  * @see Symfony\Component\DependencyInjection\Extension.ExtensionInterface::load()
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $processor = new Processor();
     $configuration = new Configuration();
     $config = $processor->process($configuration->getConfigTree(), $configs);
     // set an array full of the driver classes
     $container->setParameter('winzou_cache.internal.drivers', $config['driver']);
     // Case sensitive
     $config['options']['default_driver'] = strtolower($config['options']['default_driver']);
     // we check if the default_driver value is ok
     if (!isset($config['driver'][$config['options']['default_driver']])) {
         throw new \InvalidArgumentException('The driver "' . $config['options']['default_driver'] . '" (set in winzou_book.options.default_driver) does not exist.');
     }
     $config['internal']['default_driver_class'] = $config['driver'][$config['options']['default_driver']];
     // If the lifetime cache directory is not defined, we set it
     $config['options']['cache_dir_lifetime'] = $config['options']['cache_dir'] . DIRECTORY_SEPARATOR . 'lifetime';
     // Set the parameters
     $this->bindParameter($container, 'winzou_cache', $config);
     $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
 }