You are here

protected function DrupalTerm6Migration::query in Drupal-to-Drupal data migration 7.2

Implementation of DrupalTermMigration::query().

Return value

SelectQueryInterface

Overrides DrupalMigration::query

File

d6/taxonomy.inc, line 24
Implementation of DrupalTermMigration for Drupal 6 sources.

Class

DrupalTerm6Migration
Handling specific to a Drupal 6 source for taxonomy terms.

Code

protected function query() {

  // Note the explode - this supports the (admittedly unusual) case of
  // consolidating multiple vocabularies into one.
  $query = Database::getConnection('default', $this->sourceConnection)
    ->select('term_data', 'td')
    ->fields('td', array(
    'tid',
    'name',
    'description',
    'weight',
  ))
    ->condition('vid', explode(',', $this->sourceVocabulary), 'IN')
    ->orderBy('th.parent')
    ->distinct();

  // Join to the hierarchy so we can sort on parent, but we'll pull the
  // actual parent values in separately in case there are multiples.
  $query
    ->leftJoin('term_hierarchy', 'th', 'td.tid=th.tid');
  return $query;
}