You are here

public function ForumIndexStorage::getOriginalTermId in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/forum/src/ForumIndexStorage.php \Drupal\forum\ForumIndexStorage::getOriginalTermId()
  2. 10 core/modules/forum/src/ForumIndexStorage.php \Drupal\forum\ForumIndexStorage::getOriginalTermId()

Returns the forum term id associated with an existing forum node.

Parameters

\Drupal\node\NodeInterface $node: The existing forum node.

Return value

int The forum term id currently associated with the node.

Overrides ForumIndexStorageInterface::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();
}