Make documentation on demand configurable

This commit is contained in:
Vyacheslav Slinko 2012-10-17 17:12:36 +04:00
parent 6aac4a001e
commit aa70018abe
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ class Configuration implements ConfigurationInterface
->root('nelmio_api_doc')
->children()
->scalarNode('name')->defaultValue('API documentation')->end()
->booleanNode('on_demand')->defaultTrue()->end()
->arrayNode('sandbox')
->addDefaultsIfNotSet()
->children()

View File

@ -34,9 +34,12 @@ class NelmioApiDocExtension extends Extension
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('formatters.xml');
$loader->load('request_listener.xml');
$loader->load('services.xml');
if ($config['on_demand']) {
$loader->load('request_listener.xml');
}
if (isset($config['sandbox']['authentication'])) {
$container->setParameter('nelmio_api_doc.sandbox.authentication', $config['sandbox']['authentication']);
}