Skip to content

Commit d44237a

Browse files
committed
minor #16617 [Security] Add hint about #[CurrentUser] to the argument_value_resolver page (Seldaek)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Add hint about #[CurrentUser] to the argument_value_resolver page Right now it's only mentioned in some totally random place in https://symfony.com/doc/6.1/security.html#json-login so not so discoverable if you haven't read the "What's new" blog posts. Commits ------- a8c4ec3 Add hint about #[CurrentUser] to the argument_value_resolver page
2 parents 604d451 + a8c4ec3 commit d44237a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

controller/argument_value_resolver.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ In addition, some components and official bundles provide other value resolvers:
4949

5050
:class:`Symfony\\Component\\Security\\Http\\Controller\\UserValueResolver`
5151
Injects the object that represents the current logged in user if type-hinted
52-
with ``UserInterface``. Default value can be set to ``null`` in case
53-
the controller can be accessed by anonymous users. It requires installing
54-
the :doc:`SecurityBundle </security>`.
52+
with ``UserInterface``. You can also type-hint your own ``User`` class but you
53+
must then add the ``#[CurrentUser]`` attribute to the argument. Default value
54+
can be set to ``null`` in case the controller can be accessed by anonymous
55+
users. It requires installing the :doc:`SecurityBundle </security>`.
5556

5657
Adding a Custom Value Resolver
5758
------------------------------

0 commit comments

Comments
 (0)