You are here

protected function KeyValueEntityStorage::has in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::has()
  2. 9 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::has()

Determines if this entity already exists in storage.

Parameters

int|string $id: The original entity ID.

\Drupal\Core\Entity\EntityInterface $entity: The entity being saved.

Return value

bool TRUE if this entity exists in storage, FALSE otherwise.

Overrides EntityStorageBase::has

1 call to KeyValueEntityStorage::has()
KeyValueEntityStorage::doSave in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
Performs storage-specific saving of the entity.

File

core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php, line 191

Class

KeyValueEntityStorage
Provides a key value backend for entities.

Namespace

Drupal\Core\Entity\KeyValueStore

Code

protected function has($id, EntityInterface $entity) {
  return $this->keyValueStore
    ->has($id);
}