annotate core/lib/Drupal/Core/Session/AccountProxyInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 1fec387a4317
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Session;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Defines an interface for a service which has the current account stored.
Chris@0 7 *
Chris@14 8 * It is generally more useful to use \Drupal\Core\Session\AccountInterface
Chris@14 9 * unless one specifically needs the proxying features of this interface.
Chris@14 10 *
Chris@14 11 * @see \Drupal\Core\Session\AccountInterface
Chris@14 12 *
Chris@0 13 * @ingroup user_api
Chris@0 14 */
Chris@0 15 interface AccountProxyInterface extends AccountInterface {
Chris@0 16
Chris@0 17 /**
Chris@0 18 * Sets the currently wrapped account.
Chris@0 19 *
Chris@0 20 * Setting the current account is highly discouraged! Instead, make sure to
Chris@0 21 * inject the desired user object into the dependent code directly.
Chris@0 22 *
Chris@0 23 * A preferable method of account impersonation is to use
Chris@0 24 * \Drupal\Core\Session\AccountSwitcherInterface::switchTo() and
Chris@0 25 * \Drupal\Core\Session\AccountSwitcherInterface::switchBack().
Chris@0 26 *
Chris@0 27 * @param \Drupal\Core\Session\AccountInterface $account
Chris@0 28 * The current account.
Chris@0 29 */
Chris@0 30 public function setAccount(AccountInterface $account);
Chris@0 31
Chris@0 32 /**
Chris@0 33 * Gets the currently wrapped account.
Chris@0 34 *
Chris@0 35 * @return \Drupal\Core\Session\AccountInterface
Chris@0 36 * The current account.
Chris@0 37 */
Chris@0 38 public function getAccount();
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Sets the id of the initial account.
Chris@0 42 *
Chris@0 43 * Never use this method, its sole purpose is to work around weird effects
Chris@0 44 * during mid-request container rebuilds.
Chris@0 45 *
Chris@0 46 * @param int $account_id
Chris@0 47 * The id of the initial account.
Chris@0 48 */
Chris@0 49 public function setInitialAccountId($account_id);
Chris@0 50
Chris@0 51 }