Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AccountProxy.php

function AccountProxy::setAccount

Overrides AccountProxyInterface::setAccount

1 call to AccountProxy::setAccount()
AccountProxy::getAccount in core/lib/Drupal/Core/Session/AccountProxy.php
Gets the currently wrapped account.

File

core/lib/Drupal/Core/Session/AccountProxy.php, line 57

Class

AccountProxy
A proxied implementation of AccountInterface.

Namespace

Drupal\Core\Session

Code

public function setAccount(AccountInterface $account) {
    // If the passed account is already proxied, use the actual account instead
    // to prevent loops.
    if ($account instanceof static) {
        $account = $account->getAccount();
    }
    $this->account = $account;
    $this->id = $account->id();
    $this->eventDispatcher
        ->dispatch(new AccountSetEvent($account), AccountEvents::SET_USER);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal