W3cubDocs

/Drupal 8

protected function EntityAccessControlHandler::getCache

protected EntityAccessControlHandler::getCache($cid, $operation, $langcode, AccountInterface $account)

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.

File

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

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];
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!EntityAccessControlHandler.php/function/EntityAccessControlHandler::getCache/8.1.x