You are here

public function CiviEntityStorage::hasData in CiviCRM Entity 8.3

Determines if the storage contains any data.

Return value

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

Overrides EntityStorageBase::hasData

File

src/CiviEntityStorage.php, line 298

Class

CiviEntityStorage
Defines entity class for external CiviCRM entities.

Namespace

Drupal\civicrm_entity

Code

public function hasData() {
  if (($component = $this->entityType
    ->get('component')) !== NULL) {
    $components = $this
      ->getCiviCrmApi()
      ->getValue('Setting', [
      'name' => 'enable_components',
    ]);
    return !in_array($component, $components) ? FALSE : $this
      ->getCiviCrmApi()
      ->getCount($this->entityType
      ->get('civicrm_entity')) > 0;
  }
  return $this
    ->getCiviCrmApi()
    ->getCount($this->entityType
    ->get('civicrm_entity')) > 0;
}