diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 0b2ec84fb..53092f1b0 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -29,6 +29,10 @@ public function getConfigTreeBuilder(): TreeBuilder ->info('If true, `groups` passed to @Model annotations will be used to limit validation constraints') ->defaultFalse() ->end() + ->booleanNode('api_platform_support') + ->info('If false, the service declaration that support ApiPlatform will not be loaded even if ApiPlatform is detected in your installation') + ->defaultTrue() + ->end() ->arrayNode('cache') ->validate() ->ifTrue(function ($v) { return null !== $v['item_id'] && null === $v['pool']; }) diff --git a/src/DependencyInjection/NelmioApiDocExtension.php b/src/DependencyInjection/NelmioApiDocExtension.php index 757703632..ff6203618 100644 --- a/src/DependencyInjection/NelmioApiDocExtension.php +++ b/src/DependencyInjection/NelmioApiDocExtension.php @@ -236,7 +236,7 @@ public function load(array $configs, ContainerBuilder $container): void } // ApiPlatform support - if (isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Documentation\Documentation')) { + if ($config['api_platform_support'] && isset($bundles['ApiPlatformBundle']) && class_exists('ApiPlatform\Documentation\Documentation')) { $loader->load('api_platform.xml'); }