From 2ed5379f0b7dfab50e9ab10fc0ba02f839b3badf Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 23 Oct 2023 16:30:55 +0200 Subject: [PATCH] Add support for disabling type comments in the schema --- DependencyInjection/Configuration.php | 1 + DependencyInjection/DoctrineExtension.php | 6 ++++++ composer.json | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 641a4408e..cbf942383 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -217,6 +217,7 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition ->defaultValue(true) ->info('Enables collecting schema errors when profiling is enabled') ->end() + ->booleanNode('disable_type_comments')->end() ->scalarNode('server_version')->end() ->scalarNode('driver_class')->end() ->scalarNode('wrapper_class')->end() diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index faa0d6c30..28df498b0 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -250,6 +250,12 @@ protected function loadDbalConnection($name, array $connection, ContainerBuilder unset($connection['auto_commit']); + if (isset($connection['disable_type_comments'])) { + $configuration->addMethodCall('setDisableTypeComments', [$connection['disable_type_comments']]); + } + + unset($connection['disable_type_comments']); + if (isset($connection['schema_filter']) && $connection['schema_filter']) { $definition = new Definition(RegexSchemaAssetFilter::class, [$connection['schema_filter']]); $definition->addTag('doctrine.dbal.schema_filter', ['connection' => $name]); diff --git a/composer.json b/composer.json index cc55583af..b211702a8 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "require": { "php": "^7.4 || ^8.0", "doctrine/cache": "^1.11 || ^2.0", - "doctrine/dbal": "^3.6.0", + "doctrine/dbal": "^3.7.0", "doctrine/persistence": "^2.2 || ^3", "doctrine/sql-formatter": "^1.0.1", "symfony/cache": "^5.4 || ^6.0 || ^7.0",