From 2b7ab54b07db430cfb592191c0d3646099b36a6f Mon Sep 17 00:00:00 2001 From: Bob van de Vijver Date: Wed, 21 Feb 2024 14:22:01 +0100 Subject: [PATCH 1/2] Change controller resolver default value for auto mapping --- DependencyInjection/Configuration.php | 2 +- DependencyInjection/DoctrineExtension.php | 5 +++++ UPGRADE-3.0.md | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 2e154b6d0..ba0fed1d7 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -515,7 +515,7 @@ private function addOrmSection(ArrayNodeDefinition $node): void ->canBeDisabled() ->children() ->booleanNode('auto_mapping') - ->defaultTrue() + ->defaultNull() ->info('Set to false to disable using route placeholders as lookup criteria when the primary key doesn\'t match the argument name') ->end() ->booleanNode('evict_cache') diff --git a/DependencyInjection/DoctrineExtension.php b/DependencyInjection/DoctrineExtension.php index 044235f3d..239484159 100644 --- a/DependencyInjection/DoctrineExtension.php +++ b/DependencyInjection/DoctrineExtension.php @@ -501,6 +501,11 @@ protected function ormLoad(array $config, ContainerBuilder $container) $controllerResolverDefaults['disabled'] = true; } + if ($config['controller_resolver']['auto_mapping'] === null) { + trigger_deprecation('doctrine/doctrine-bundle', '2.12', 'The default value of "doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`. Explicitly configure `true` to keep existing behaviour.'); + $config['controller_resolver']['auto_mapping'] = true; + } + if (! $config['controller_resolver']['auto_mapping']) { $controllerResolverDefaults['mapping'] = []; } diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 03ee914eb..27b971767 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1,6 +1,17 @@ UPGRADE FROM 2.x to 3.0 ======================= +Configuration +------------- + +### Controller resolver auto mapping default configuration changed + +The default value of `doctrine.orm.controller_resolver.auto_mapping` has changed from `true` to `false`. + +Auto mapping uses any route parameters that match with a field name of the Entity to resolve as criteria in a find by query. + +If you were relying on this functionality, you will need to explicitly configure this now. + Types ----- From 8c2983d04296961e7fa9d170c4c11ae150a32165 Mon Sep 17 00:00:00 2001 From: Bob van de Vijver Date: Thu, 14 Mar 2024 13:51:37 +0100 Subject: [PATCH 2/2] Add 2.12 upgrade notes --- UPGRADE-2.12.md | 13 +++++++++++++ UPGRADE-3.0.md | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 UPGRADE-2.12.md diff --git a/UPGRADE-2.12.md b/UPGRADE-2.12.md new file mode 100644 index 000000000..77e17d2e9 --- /dev/null +++ b/UPGRADE-2.12.md @@ -0,0 +1,13 @@ +UPGRADE FROM 2.11 to 2.12 +======================== + +Configuration +------------- + +### Controller resolver auto mapping default configuration will be changed + +The default value of `doctrine.orm.controller_resolver.auto_mapping` will be changed from `true` to `false` in 3.0. + +Auto mapping uses any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query. + +If you are relying on this functionality, you will need to configure it explicitly to silence the deprecation notice. diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 27b971767..faf694be0 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -8,7 +8,7 @@ Configuration The default value of `doctrine.orm.controller_resolver.auto_mapping` has changed from `true` to `false`. -Auto mapping uses any route parameters that match with a field name of the Entity to resolve as criteria in a find by query. +Auto mapping uses any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query. If you were relying on this functionality, you will need to explicitly configure this now.