function VocabularyTranslation::query
Prepares query object to retrieve data from the source database.
This method should not be called directly. It is called automatically from SqlBase::prepareQuery().
Return value
\Drupal\Core\Database\Query\SelectInterface A Select query object with the source data.
Overrides SqlBase::query
File
- 
              core/
modules/ taxonomy/ src/ Plugin/ migrate/ source/ d6/ VocabularyTranslation.php, line 28  
Class
- VocabularyTranslation
 - Drupal 6 i18n vocabulary translations source from database.
 
Namespace
Drupal\taxonomy\Plugin\migrate\source\d6Code
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.