diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 22ee2341f..ce0f1f5c3 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -33,6 +33,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 d79d7c27e..c28b8a8d5 100644 --- a/src/DependencyInjection/NelmioApiDocExtension.php +++ b/src/DependencyInjection/NelmioApiDocExtension.php @@ -242,7 +242,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'); }