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/d7/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\VocabularyTranslation::query()
  2. 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php \Drupal\taxonomy\Plugin\migrate\source\d7\VocabularyTranslation::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides Vocabulary::query

File

core/modules/taxonomy/src/Plugin/migrate/source/d7/VocabularyTranslation.php, line 18

Class

VocabularyTranslation
Drupal 7 vocabulary translations from source database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d7

Code

public function query() {
  $query = parent::query();
  $query
    ->leftjoin('i18n_string', 'i18n', 'CAST (v.vid AS CHAR(222))= i18n.objectid');
  $query
    ->innerJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
  $query
    ->condition('type', 'vocabulary')
    ->fields('lt')
    ->fields('i18n');
  $query
    ->addField('lt', 'lid', 'lt_lid');
  if ($this
    ->getDatabase()
    ->schema()
    ->fieldExists('taxonomy_vocabulary', 'language')) {
    $query
      ->addField('v', 'language', 'v_language');
  }
  if ($this
    ->getDatabase()
    ->schema()
    ->fieldExists('taxonomy_vocabulary', 'i18n_mode')) {
    $query
      ->addField('v', 'i18n_mode');
  }
  return $query;
}