public AccountSwitcherInterface::switchTo(AccountInterface $account)
Safely switches to another account.
Each invocation of AccountSwitcherInterface::switchTo() must be matched by a corresponding invocation of AccountSwitcherInterface::switchBack() in the same function.
\Drupal\Core\Session\AccountInterface $account: The account to switch to.
\Drupal\Core\Session\AccountSwitcherInterface $this.
public function switchTo(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!AccountSwitcherInterface.php/function/AccountSwitcherInterface::switchTo/8.1.x