public AccountProxyInterface::setAccount(AccountInterface $account)
Sets the currently wrapped account.
Setting the current account is highly discouraged! Instead, make sure to inject the desired user object into the dependent code directly.
A preferable method of account impersonation is to use \Drupal\Core\Session\AccountSwitcherInterface::switchTo() and \Drupal\Core\Session\AccountSwitcherInterface::switchBack().
Parameters
\Drupal\Core\Session\AccountInterface $account: The current account.
File
- core/lib/Drupal/Core/Session/AccountProxyInterface.php, line 25
Class
- AccountProxyInterface
- Defines an interface for a service which has the current account stored.
Namespace
Drupal\Core\Session
Code
public function setAccount(AccountInterface $account);
Please login to continue.