function ForumIndexStorage::getOriginalTermId

Same name in other branches
  1. 9 core/modules/forum/src/ForumIndexStorage.php \Drupal\forum\ForumIndexStorage::getOriginalTermId()
  2. 8.9.x core/modules/forum/src/ForumIndexStorage.php \Drupal\forum\ForumIndexStorage::getOriginalTermId()
  3. 11.x core/modules/forum/src/ForumIndexStorage.php \Drupal\forum\ForumIndexStorage::getOriginalTermId()

File

core/modules/forum/src/ForumIndexStorage.php, line 34

Class

ForumIndexStorage
Handles CRUD operations to {forum_index} table.

Namespace

Drupal\forum

Code

public function getOriginalTermId(NodeInterface $node) {
    return $this->database
        ->queryRange("SELECT [f].[tid] FROM {forum} [f] INNER JOIN {node} [n] ON [f].[vid] = [n].[vid] WHERE [n].[nid] = :nid ORDER BY [f].[vid] DESC", 0, 1, [
        ':nid' => $node->id(),
    ])
        ->fetchField();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.