You are here

public function RevisionsManager::revisionIds in Node Revisions Autoclean 8

Loads revisions IDs by langcode.

Parameters

Drupal\node\NodeInterface $node: The node.

string $langcode: The langcode.

Return value

mixed Array of revisions.

1 call to RevisionsManager::revisionIds()
RevisionsManager::loadRevisions in src/Services/RevisionsManager.php
Loads revisions of a node.

File

src/Services/RevisionsManager.php, line 85

Class

RevisionsManager
Class RevisionsManager.

Namespace

Drupal\node_revisions_autoclean\Services

Code

public function revisionIds(NodeInterface $node, $langcode = NULL) {
  if (isset($langcode)) {
    return $this->database
      ->query('SELECT vid FROM {node_revision} WHERE nid=:nid AND langcode=:langcode ORDER BY vid', [
      ':nid' => $node
        ->id(),
      ':langcode' => $langcode,
    ])
      ->fetchCol();
  }
  else {
    return $this->database
      ->query('SELECT vid FROM {node_revision} WHERE nid=:nid ORDER BY vid', [
      ':nid' => $node
        ->id(),
    ])
      ->fetchCol();
  }
}