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().
\Drupal\Core\Session\AccountInterface $account: The current account.
public function setAccount(AccountInterface $account);
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Session!AccountProxyInterface.php/function/AccountProxyInterface::setAccount/8.1.x