protected function DrupalTerm7Migration::query in Drupal-to-Drupal data migration 7.2
@abstract The base source query for this migration.
Return value
Overrides DrupalMigration::query
File
- d7/
taxonomy.inc, line 15 - Implementation of DrupalTermMigration for Drupal 7 sources.
Class
- DrupalTerm7Migration
- @file Implementation of DrupalTermMigration for Drupal 7 sources.
Code
protected function query() {
$query = Database::getConnection('default', $this->sourceConnection)
->select('taxonomy_term_data', 'td')
->fields('td', array(
'tid',
'name',
'description',
'weight',
'format',
))
->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('taxonomy_term_hierarchy', 'th', 'td.tid=th.tid');
$query
->innerJoin('taxonomy_vocabulary', 'v', 'td.vid=v.vid');
$query
->condition('v.machine_name', array(
$this->sourceVocabulary,
), 'IN');
return $query;
}