You are here

public function Term::query in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/taxonomy/src/Plugin/migrate/source/Term.php \Drupal\taxonomy\Plugin\migrate\source\Term::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

core/modules/taxonomy/src/Plugin/migrate/source/Term.php, line 42
Contains \Drupal\taxonomy\Plugin\migrate\source\Term.

Class

Term
Taxonomy term source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source

Code

public function query() {
  if ($this
    ->getModuleSchemaVersion('taxonomy') >= 7000) {
    $this->termDataTable = 'taxonomy_term_data';
    $this->termHierarchyTable = 'taxonomy_term_hierarchy';
  }
  else {
    $this->termDataTable = 'term_data';
    $this->termHierarchyTable = 'term_hierarchy';
  }
  $query = $this
    ->select($this->termDataTable, 'td')
    ->fields('td')
    ->distinct()
    ->orderBy('tid');
  if (isset($this->configuration['vocabulary'])) {
    $query
      ->condition('vid', $this->configuration['vocabulary'], 'IN');
  }
  return $query;
}