From 54d3a9b96e0c86031d3eb1f690e0a3aff02d1c61 Mon Sep 17 00:00:00 2001 From: Romain Pierre Date: Tue, 19 Nov 2024 16:26:10 +0100 Subject: [PATCH] feat(config): allow to disable api platform support --- src/DependencyInjection/Configuration.php | 4 ++++ src/DependencyInjection/NelmioApiDocExtension.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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'); }