public function load(array $configs, ContainerBuilder $container) { $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $processor = new Processor(); $configuration = new Configuration(); $config = $processor->process($configuration->getConfigTree(), $configs); $loader->load('services.xml'); $annotationsToLoad = array(); if ($config['router']['annotations']) { $annotationsToLoad[] = 'routing.xml'; } if ($config['request']['converters']) { $annotationsToLoad[] = 'converters.xml'; } if ($config['view']['annotations']) { $annotationsToLoad[] = 'view.xml'; } if ($config['cache']['annotations']) { $annotationsToLoad[] = 'cache.xml'; } if ($annotationsToLoad) { // must be first $loader->load('annotations.xml'); foreach ($annotationsToLoad as $config) { $loader->load($config); } } }