function AccountProxy::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::__construct()
  2. 10 core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::__construct()
  3. 11.x core/lib/Drupal/Core/Session/AccountProxy.php \Drupal\Core\Session\AccountProxy::__construct()

AccountProxy constructor.

Parameters

\Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher: Event dispatcher.

File

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

Class

AccountProxy
A proxied implementation of AccountInterface.

Namespace

Drupal\Core\Session

Code

public function __construct(EventDispatcherInterface $eventDispatcher = NULL) {
    if (!$eventDispatcher) {
        @trigger_error('Calling AccountProxy::__construct() without the $eventDispatcher argument is deprecated in drupal:8.8.0. The $eventDispatcher argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3009387', E_USER_DEPRECATED);
        $eventDispatcher = \Drupal::service('event_dispatcher');
    }
    $this->eventDispatcher = $eventDispatcher;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.