You are here

public function ConsentAgreementStorage::countDefaultLanguageRevisions in General Data Protection Regulation 8

Same name and namespace in other branches
  1. 8.2 modules/gdpr_consent/src/ConsentAgreementStorage.php \Drupal\gdpr_consent\ConsentAgreementStorage::countDefaultLanguageRevisions()
  2. 3.0.x modules/gdpr_consent/src/ConsentAgreementStorage.php \Drupal\gdpr_consent\ConsentAgreementStorage::countDefaultLanguageRevisions()

Counts the number of revisions in the default language.

Parameters

\Drupal\gdpr_consent\Entity\ConsentAgreementInterface $entity: The Consent Agreement entity.

Return value

int The number of revisions in the default language.

Overrides ConsentAgreementStorageInterface::countDefaultLanguageRevisions

File

modules/gdpr_consent/src/ConsentAgreementStorage.php, line 43

Class

ConsentAgreementStorage
Defines the storage handler class for Consent Agreement entities.

Namespace

Drupal\gdpr_consent

Code

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