You are here

protected function EntityAccessControlHandler::getCache in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php \Drupal\Core\Entity\EntityAccessControlHandler::getCache()
  2. 10 core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php \Drupal\Core\Entity\EntityAccessControlHandler::getCache()

Tries to retrieve a previously cached access value from the static cache.

Parameters

string $cid: Unique string identifier for the entity/operation, for example the entity UUID or a custom string.

string $operation: The entity operation. Usually one of 'view', 'update', 'create' or 'delete'.

string $langcode: The language code for which to check access.

\Drupal\Core\Session\AccountInterface $account: The user for which to check access.

Return value

\Drupal\Core\Access\AccessResultInterface|null The cached AccessResult, or NULL if there is no record for the given user, operation, langcode and entity in the cache.

2 calls to EntityAccessControlHandler::getCache()
EntityAccessControlHandler::access in core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
Checks access to an operation on a given entity or entity translation.
EntityAccessControlHandler::createAccess in core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php
Checks access to create an entity.

File

core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php, line 187

Class

EntityAccessControlHandler
Defines a default implementation for entity access control handler.

Namespace

Drupal\Core\Entity

Code

protected function getCache($cid, $operation, $langcode, AccountInterface $account) {

  // Return from cache if a value has been set for it previously.
  if (isset($this->accessCache[$account
    ->id()][$cid][$langcode][$operation])) {
    return $this->accessCache[$account
      ->id()][$cid][$langcode][$operation];
  }
}