You are here

public function VocabularyTranslation::query in Drupal 8

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

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyTranslation.php, line 21

Class

VocabularyTranslation
Drupal 6 vocabulary translations from source database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d6

Code

public function query() {
  $query = $this
    ->select('vocabulary', 'v')
    ->fields('v')
    ->fields('i18n', [
    'lid',
    'type',
    'property',
    'objectid',
  ])
    ->fields('lt', [
    'lid',
    'translation',
  ])
    ->condition('i18n.type', 'vocabulary');
  $query
    ->addField('lt', 'language', 'lt.language');

  // The i18n_strings table has two columns containing the object ID, objectid
  // and objectindex. The objectid column is a text field. Therefore, for the
  // join to work in PostgreSQL, use the objectindex field as this is numeric
  // like the vid field.
  $query
    ->join('i18n_strings', 'i18n', 'v.vid = i18n.objectindex');
  $query
    ->innerJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
  return $query;
}