You are here

public function DataPolicyStorage::countDefaultLanguageRevisions in Data Policy 8

Counts the number of revisions in the default language.

Parameters

\Drupal\data_policy\Entity\DataPolicyInterface $entity: The Data policy entity.

Return value

int The number of revisions in the default language.

Overrides DataPolicyStorageInterface::countDefaultLanguageRevisions

File

src/DataPolicyStorage.php, line 43

Class

DataPolicyStorage
Defines the storage handler class for Data policy entities.

Namespace

Drupal\data_policy

Code

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