Skip to content

Commit 1a3b650

Browse files
Deprecate not setting doctrine.orm.controller_resolver.auto_mapping (#1762)
1 parent 26a87a7 commit 1a3b650

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ private function addOrmSection(ArrayNodeDefinition $node): void
515515
->canBeDisabled()
516516
->children()
517517
->booleanNode('auto_mapping')
518-
->defaultTrue()
518+
->defaultNull()
519519
->info('Set to false to disable using route placeholders as lookup criteria when the primary key doesn\'t match the argument name')
520520
->end()
521521
->booleanNode('evict_cache')

DependencyInjection/DoctrineExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ protected function ormLoad(array $config, ContainerBuilder $container)
501501
$controllerResolverDefaults['disabled'] = true;
502502
}
503503

504+
if ($config['controller_resolver']['auto_mapping'] === null) {
505+
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.');
506+
$config['controller_resolver']['auto_mapping'] = true;
507+
}
508+
504509
if (! $config['controller_resolver']['auto_mapping']) {
505510
$controllerResolverDefaults['mapping'] = [];
506511
}

UPGRADE-2.12.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
UPGRADE FROM 2.11 to 2.12
2+
========================
3+
4+
Configuration
5+
-------------
6+
7+
### Controller resolver auto mapping default configuration will be changed
8+
9+
The default value of `doctrine.orm.controller_resolver.auto_mapping` will be changed from `true` to `false` in 3.0.
10+
11+
Auto mapping uses any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query.
12+
13+
If you are relying on this functionality, you will need to configure it explicitly to silence the deprecation notice.

UPGRADE-3.0.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
UPGRADE FROM 2.x to 3.0
22
=======================
33

4+
Configuration
5+
-------------
6+
7+
### Controller resolver auto mapping default configuration changed
8+
9+
The default value of `doctrine.orm.controller_resolver.auto_mapping` has changed from `true` to `false`.
10+
11+
Auto mapping uses any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query.
12+
13+
If you were relying on this functionality, you will need to explicitly configure this now.
14+
415
Types
516
-----
617

0 commit comments

Comments
 (0)