Skip to content

Deprecate not setting doctrine.orm.controller_resolver.auto_mapping #1762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
5 changes: 5 additions & 0 deletions DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [];
}
Expand Down
13 changes: 13 additions & 0 deletions UPGRADE-2.12.md
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
@@ -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 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.

Types
-----

Expand Down