Skip to content

Commit f6a28d4

Browse files
committed
bug symfony#57248 [DoctrineBridge] Revert deprecating by-{id} mapping of entities (nicolas-grekas)
This PR was merged into the 7.1 branch. Discussion ---------- [DoctrineBridge] Revert deprecating by-{id} mapping of entities | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT As discussed in symfony#57211 Introduced in symfony#54455 Commits ------- b81a62c [DoctrineBridge] Revert deprecating by-{id} mapping of entities
2 parents 31c597f + b81a62c commit f6a28d4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Symfony/Bridge/Doctrine/ArgumentResolver/EntityValueResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ private function getIdentifier(Request $request, MapEntity $options, ArgumentMet
156156

157157
return $id ?? ($options->stripNull ? false : null);
158158
}
159-
if ($request->attributes->has('id')) {
160-
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');
161159

160+
if ($request->attributes->has('id')) {
162161
return $request->attributes->get('id') ?? ($options->stripNull ? false : null);
163162
}
164163

0 commit comments

Comments
 (0)