You are here

public function HeartbeatStorage::countDefaultLanguageRevisions in Heartbeat 8

Counts the number of revisions in the default language.

Parameters

\Drupal\heartbeat\Entity\HeartbeatInterface $entity: The Heartbeat entity.

Return value

int The number of revisions in the default language.

Overrides HeartbeatStorageInterface::countDefaultLanguageRevisions

File

src/HeartbeatStorage.php, line 43

Class

HeartbeatStorage
Defines the storage handler class for Heartbeat entities.

Namespace

Drupal\heartbeat

Code

public function countDefaultLanguageRevisions(HeartbeatInterface $entity) {
  return $this->database
    ->query('SELECT COUNT(*) FROM {heartbeat_field_revision} WHERE id = :id AND default_langcode = 1', array(
    ':id' => $entity
      ->id(),
  ))
    ->fetchField();
}