You are here

public function EntityconnectCache::__construct in Entity connect 8.2

Saves our dependencies.

Parameters

\Drupal\Core\TempStore\PrivateTempStoreFactory $store: The private storage object.

\Drupal\Core\Session\SessionManager $sessionManager: The session manager.

\Drupal\Core\Session\AccountInterface $account: The current user account object.

File

src/EntityconnectCache.php, line 49

Class

EntityconnectCache
A custom class for managing the Entityconnect cache.

Namespace

Drupal\entityconnect

Code

public function __construct(PrivateTempStoreFactory $store, SessionManager $sessionManager, AccountInterface $account) {
  $this->store = $store
    ->get('entityconnect');
  $this->sessionManager = $sessionManager;
  $this->account = $account;

  // Start a manual session for anonymous users.
  if ($account
    ->isAnonymous() && !isset($_SESSION['entityconnect_session'])) {
    $_SESSION['entityconnect_session'] = TRUE;
    $sessionManager
      ->start();
  }
}