File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -993,9 +993,9 @@ shown above.
993
993
3) Retrieving the User Object
994
994
-----------------------------
995
995
996
- After authentication, the ``User `` object of the current user can be accessed
997
- via the ``security.token_storage `` service. From inside a controller, this will
998
- look like::
996
+ After authentication, the ``User `` object of the current user can be accessed either
997
+ via the ``security.token_storage `` service or via type-hinting the `` UserInterface `` as an argument.
998
+ From inside a controller, this will look like::
999
999
1000
1000
use Symfony\Component\Security\Core\User\UserInterface;
1001
1001
@@ -1005,7 +1005,7 @@ look like::
1005
1005
throw $this->createAccessDeniedException();
1006
1006
}
1007
1007
1008
- // the above is a shortcut for this
1008
+ // type-hinting the UserInterface like above is a shortcut for this
1009
1009
$user = $this->get('security.token_storage')->getToken()->getUser();
1010
1010
}
1011
1011
You can’t perform that action at this time.
0 commit comments