From 99cc89df9c5b97ece652fc85917ced47c482b486 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 28 May 2024 17:54:42 +0200 Subject: [PATCH] [DoctrineBridge] Improve deprecation when mapping by `{id}` --- .../Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php b/src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php index d2ee05b42ce1d..cd04081515478 100644 --- a/src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php +++ b/src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php @@ -157,7 +157,7 @@ private function getIdentifier(Request $request, MapEntity $options, ArgumentMet return $id ?? ($options->stripNull ? false : null); } if ($request->attributes->has('id')) { - trigger_deprecation('symfony/doctrine-bridge', '7.1', 'Relying on auto-mapping for Doctrine entities is deprecated for argument $%s of "%s": declare the mapping using either the #[MapEntity] attribute or mapped route parameters.', $argument->getName(), method_exists($argument, 'getControllerName') ? $argument->getControllerName() : 'n/a'); + trigger_deprecation('symfony/doctrine-bridge', '7.1', 'Relying on parameter "{id}" in route definitions is deprecated for Doctrine entities, use "{%s}" instead for controller "%s".', $argument->getName(), method_exists($argument, 'getControllerName') ? $argument->getControllerName() : 'n/a'); return $request->attributes->get('id') ?? ($options->stripNull ? false : null); }