Skip to content

Commit 58f7499

Browse files
committed
Removed references about UserInterface type-hinting
1 parent 0387f3b commit 58f7499

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

security.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -994,28 +994,21 @@ shown above.
994994
-----------------------------
995995

996996
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::
999-
1000-
use Symfony\Component\Security\Core\User\UserInterface;
997+
via the ``getUser()`` shortcut (which uses the ``security.token_storage``
998+
service). From inside a controller, this will look like::
1001999

10021000
public function indexAction()
10031001
{
10041002
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
10051003

10061004
$user = $this->getUser();
1007-
// or you can also type-hint a method argument with UserInterface: e.g. "UserInterface $user"
10081005
}
10091006

10101007
.. tip::
10111008

10121009
The user will be an object and the class of that object will depend on
10131010
your :ref:`user provider <security-user-providers>`.
10141011

1015-
.. versionadded:: 3.2
1016-
The ability to get the user by type-hinting an argument with UserInterface
1017-
was introduced in Symfony 3.2.
1018-
10191012
Now you can call whatever methods are on *your* User object. For example,
10201013
if your User object has a ``getFirstName()`` method, you could use that::
10211014

0 commit comments

Comments
 (0)