Skip to content

Commit

Permalink
Fully deprecate controller resolver auto mapping (#1804)
Browse files Browse the repository at this point in the history
  • Loading branch information
bobvandevijver authored Jun 24, 2024
1 parent 1bbe59a commit 568affa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
13 changes: 13 additions & 0 deletions UPGRADE-2.13.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
UPGRADE FROM 2.12 to 2.13
========================

Configuration
-------------

### Controller resolver auto mapping deprecated

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.

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 can update your code to use explicit mapped route parameters instead.
8 changes: 4 additions & 4 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ UPGRADE FROM 2.x to 3.0
Configuration
-------------

### Controller resolver auto mapping default configuration changed
### Controller resolver auto mapping can no longer be configured

The default value of `doctrine.orm.controller_resolver.auto_mapping` has changed from `true` to `false`.
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.

Auto mapping uses any route parameter that matches with a field name of the Entity to resolve as criteria in a find by query.
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.

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

Types
-----
Expand Down
4 changes: 4 additions & 0 deletions src/DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ protected function ormLoad(array $config, ContainerBuilder $container)
$config['controller_resolver']['auto_mapping'] = true;
}

if ($config['controller_resolver']['auto_mapping'] === true) {
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.');
}

if (! $config['controller_resolver']['auto_mapping']) {
$controllerResolverDefaults['mapping'] = [];
}
Expand Down
3 changes: 2 additions & 1 deletion tests/baseline-ignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
%"doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`.%
%"doctrine.orm.controller_resolver.auto_mapping" will be changed from `true` to `false`.%
%Enabling the controller resolver automapping feature has been deprecated.%

0 comments on commit 568affa

Please sign in to comment.