You are here

public function ForumIndexStorage::getOriginalTermId in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 38
Contains \Drupal\forum\ForumIndexStorage.

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, array(
    ':nid' => $node
      ->id(),
  ))
    ->fetchField();
}