You are here

public function OpignoAnswerStorage::countDefaultLanguageRevisions in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/OpignoAnswerStorage.php \Drupal\opigno_module\OpignoAnswerStorage::countDefaultLanguageRevisions()

Counts the number of revisions in the default language.

Parameters

\Drupal\opigno_module\Entity\OpignoAnswerInterface $entity: The Answer entity.

Return value

int The number of revisions in the default language.

Overrides OpignoAnswerStorageInterface::countDefaultLanguageRevisions

File

src/OpignoAnswerStorage.php, line 43

Class

OpignoAnswerStorage
Defines the storage handler class for Answer entities.

Namespace

Drupal\opigno_module

Code

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