function TermNode::prepareRow

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode::prepareRow()
  2. 8.9.x core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode::prepareRow()
  3. 11.x core/modules/taxonomy/src/Plugin/migrate/source/d6/TermNode.php \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode::prepareRow()

Overrides SourcePluginBase::prepareRow

File

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

Class

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

Namespace

Drupal\taxonomy\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {
  // Select the terms belonging to the revision selected.
  $query = $this->select('term_node', 'tn')
    ->fields('tn', [
    'tid',
  ])
    ->condition('n.nid', $row->getSourceProperty('nid'));
  $query->join('node', 'n', static::JOIN);
  $query->innerJoin('term_data', 'td', '[td].[tid] = [tn].[tid] AND [td].[vid] = :vid', [
    ':vid' => $this->configuration['vid'],
  ]);
  $row->setSourceProperty('tid', $query->execute()
    ->fetchCol());
  return parent::prepareRow($row);
}

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