Skip to content
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

Fully deprecate controller resolver auto mapping #1804

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
Loading