3 namespace Drupal\taxonomy\Plugin\migrate\source\d6;
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
8 * Drupal 6 vocabulary translations from source database.
11 * id = "d6_taxonomy_vocabulary_translation",
12 * source_provider = "taxonomy"
15 class VocabularyTranslation extends DrupalSqlBase {
20 public function query() {
21 $query = $this->select('vocabulary', 'v')
22 ->fields('v', ['vid', 'name', 'description'])
23 ->fields('i18n', ['lid', 'type', 'property', 'objectid'])
24 ->fields('lt', ['lid', 'translation'])
25 ->condition('i18n.type', 'vocabulary');
26 $query->addField('lt', 'language', 'language');
27 // The i18n_strings table has two columns containing the object ID, objectid
28 // and objectindex. The objectid column is a text field. Therefore, for the
29 // join to work in PostgreSQL, use the objectindex field as this is numeric
30 // like the vid field.
31 $query->join('i18n_strings', 'i18n', 'v.vid = i18n.objectindex');
32 $query->leftJoin('locales_target', 'lt', 'lt.lid = i18n.lid');
40 public function fields() {
42 'vid' => $this->t('The vocabulary ID.'),
43 'language' => $this->t('Language for this field.'),
44 'property' => $this->t('Name of property being translated.'),
45 'translation' => $this->t('Translation of either the title or explanation.'),
52 public function getIds() {
53 $ids['vid']['type'] = 'integer';