Skip to content

Commit 568affa

Browse files
Fully deprecate controller resolver auto mapping (#1804)
1 parent 1bbe59a commit 568affa

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

UPGRADE-2.13.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
UPGRADE FROM 2.12 to 2.13
2+
========================
3+
4+
Configuration
5+
-------------
6+
7+
### Controller resolver auto mapping deprecated
8+
9+
The controller resolver auto mapping functionality has been deprecated with Symfony 7.1, and is replaced with explicit mapped route parameters. Enabling the auto mapper by default using this bundle is now deprecated as well.
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 can update your code to use explicit mapped route parameters instead.

UPGRADE-3.0.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ UPGRADE FROM 2.x to 3.0
44
Configuration
55
-------------
66

7-
### Controller resolver auto mapping default configuration changed
7+
### Controller resolver auto mapping can no longer be configured
88

9-
The default value of `doctrine.orm.controller_resolver.auto_mapping` has changed from `true` to `false`.
9+
The `doctrine.orm.controller_resolver.auto_mapping` option now only accepts `false` as value, to disallow the usage of the controller resolver auto mapping feature by default. The configuration option will be fully removed in 4.0.
1010

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.
11+
Auto mapping used any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query. This method has been deprecated in Symfony 7.1 and is replaced with mapped route parameters.
1212

13-
If you were relying on this functionality, you will need to explicitly configure this now.
13+
If you were relying on this functionality, you will need to update your code to use explicit mapped route parameters instead.
1414

1515
Types
1616
-----

src/DependencyInjection/DoctrineExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,10 @@ protected function ormLoad(array $config, ContainerBuilder $container)
529529
$config['controller_resolver']['auto_mapping'] = true;
530530
}
531531

532+
if ($config['controller_resolver']['auto_mapping'] === true) {
533+
trigger_deprecation('doctrine/doctrine-bundle', '2.13', 'Enabling the controller resolver automapping feature has been deprecated. Symfony Mapped Route Parameters should be used as replacement.');
534+
}
535+
532536
if (! $config['controller_resolver']['auto_mapping']) {
533537
$controllerResolverDefaults['mapping'] = [];
534538
}

tests/baseline-ignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
%"doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`.%
1+
%"doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`.%
2+
%Enabling the controller resolver automapping feature has been deprecated.%

0 commit comments

Comments
 (0)