Remove SwaggerUI controller when TwigBundle is not registered

This commit is contained in:
Guilhem Niot 2017-08-27 17:58:22 +02:00
parent 2b95b1bd0f
commit 44422d86a0

View File

@ -88,6 +88,9 @@ final class NelmioApiDocExtension extends Extension implements PrependExtensionI
// ApiPlatform support
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['TwigBundle'])) {
$container->removeDefinition('nelmio_api_doc.controller.swagger_ui');
}
if (isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Core\Documentation\Documentation')) {
$loader->load('api_platform.xml');
}