You are here

public function EntityStorageBase::hasData in Drupal 10

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

Determines if the storage contains any data.

Return value

bool TRUE if the storage contains data, FALSE if not.

Overrides EntityStorageInterface::hasData

3 methods override EntityStorageBase::hasData()
ConfigEntityStorage::hasData in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Determines if the storage contains any data.
ContentEntityNullStorage::hasData in core/lib/Drupal/Core/Entity/ContentEntityNullStorage.php
Determines if the storage contains any data.
KeyValueEntityStorage::hasData in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
Determines if the storage contains any data.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 613

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function hasData() {
  return (bool) $this
    ->getQuery()
    ->accessCheck(FALSE)
    ->range(0, 1)
    ->execute();
}