Skip to content

Commit 17cf5da

Browse files
bug #48032 [SecurityBundle] Set UserValueResolver's priority higher than EntityValueResolver (kbond)
This PR was merged into the 6.2 branch. Discussion ---------- [SecurityBundle] Set `UserValueResolver`'s priority higher than `EntityValueResolver` | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a `UserValueResolver`'s priority is currently `40` and `EntityValueResolver`'s priority is `110` (configured in doctrine-bundle). Currently, to use the `CurrentUser` attribute and `MapEntity` (when `auto_mapping` is enabled), you need to do the following to have it work: ```php public function postAction( #[CurrentUser] #[MapEntity(disabled: true)] User $user, Post $post ) ``` This removes this need for `#[MapEntity(disabled: true)]` but I'm not sure the larger impact of increasing the priority of `UserValueResolver`. Here is some context as to why the priorities are they way they are: - doctrine/DoctrineBundle#1554 (comment) - symfony/symfony#18510 Commits ------- 48499b99c4 Set `UserValueResolver`'s priority higher than `EntityValueResolver`
2 parents 706d8cc + 6357d23 commit 17cf5da

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Resources/config/security.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
->args([
101101
service('security.token_storage'),
102102
])
103-
->tag('controller.argument_value_resolver', ['priority' => 40])
103+
->tag('controller.argument_value_resolver', ['priority' => 120])
104104

105105
// Authentication related services
106106
->set('security.authentication.trust_resolver', AuthenticationTrustResolver::class)

0 commit comments

Comments
 (0)