You are here

public function CheckedEntityCache::add in Permissions by Term 8

Same name and namespace in other branches
  1. 8.2 modules/permissions_by_entity/src/Service/CheckedEntityCache.php \Drupal\permissions_by_entity\Service\CheckedEntityCache::add()

Adds a fieldable entity to the cache.

If the entity has already been added to the cache, nothing will be done.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: A fieldable entity.

File

modules/permissions_by_entity/src/Service/CheckedEntityCache.php, line 42

Class

CheckedEntityCache
Class CheckedEntityCache.

Namespace

Drupal\permissions_by_entity\Service

Code

public function add(FieldableEntityInterface $entity) {

  // In order to avoid duplicate entries we check if the entity is already in
  // the list of entities.
  if (!$this
    ->isChecked($entity)) {
    $this->entities[] = $entity;
  }
}