You are here

public function PhotosImageStorage::countDefaultLanguageRevisions in Album Photos 6.0.x

Same name and namespace in other branches
  1. 8.5 src/PhotosImageStorage.php \Drupal\photos\PhotosImageStorage::countDefaultLanguageRevisions()

Counts the number of revisions in the default language.

Parameters

\Drupal\photos\PhotosImageInterface $image: The image entity.

Return value

int The number of revisions in the default language.

Overrides PhotosImageStorageInterface::countDefaultLanguageRevisions

File

src/PhotosImageStorage.php, line 40

Class

PhotosImageStorage
Defines the storage handler class for photos images.

Namespace

Drupal\photos

Code

public function countDefaultLanguageRevisions(PhotosImageInterface $image) {
  return $this->database
    ->query('SELECT COUNT(*) FROM {' . $this
    ->getRevisionDataTable() . '} WHERE fid = :fid AND default_langcode = 1', [
    ':fid' => $image
      ->id(),
  ])
    ->fetchField();
}