Drupal 8  8.0.2
AccountProxyInterface Interface Reference
Inheritance diagram for AccountProxyInterface:

Public Member Functions

 setAccount (AccountInterface $account)
 
 getAccount ()
 
 setInitialAccountId ($account_id)
 

Additional Inherited Members

Detailed Description

Defines an interface for a service which has the current account stored.

Member Function Documentation

getAccount ( )

Gets the currently wrapped account.

Returns
The current account.

Implemented in AccountProxy.

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 ::switchTo() and ::switchBack().

Parameters
\Drupal\Core\Session\AccountInterface$accountThe current account.

Implemented in AccountProxy.

setInitialAccountId (   $account_id)

Sets the id of the initial account.

Never use this method, its sole purpose is to work around weird effects during mid-request container rebuilds.

Parameters
int$account_idThe id of the initial account.

Implemented in AccountProxy.


The documentation for this interface was generated from the following file: