You are here

public function TermNode::query in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode::query()
  2. 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php, line 48

Class

TermNode
Drupal 6 term/node relationships (current revision) source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d6

Code

public function query() {
  $query = $this
    ->select('term_node', 'tn')
    ->distinct()
    ->fields('tn', [
    'nid',
    'vid',
  ])
    ->fields('n', [
    'type',
  ]);

  // Because this is an inner join it enforces the current revision.
  $query
    ->innerJoin('term_data', 'td', '[td].[tid] = [tn].[tid] AND [td].[vid] = :vid', [
    ':vid' => $this->configuration['vid'],
  ]);
  $query
    ->innerJoin('node', 'n', static::JOIN);
  return $query;
}