select() call - this ensures * that the query is executed against the database configured for this * source plugin. */ return $this->select('migrate_example_beer_topic', 'met') ->fields('met', ['style', 'details', 'style_parent', 'region', 'hoppiness']) // We sort this way to ensure parent terms are imported first. ->orderBy('style_parent', 'ASC'); } /** * {@inheritdoc} */ public function fields() { /** * This method simply documents the available source fields provided by * the source plugin, for use by front-end tools. It returns an array keyed * by field/column name, with the value being a translated string explaining * to humans what the field represents. You should always */ $fields = [ 'style' => $this->t('Account ID'), 'details' => $this->t('Blocked/Allowed'), 'style_parent' => $this->t('Registered date'), // These values are not currently migrated - it's OK to skip fields you // don't need. 'region' => $this->t('Region the style is associated with'), 'hoppiness' => $this->t('Hoppiness of the style'), ]; return $fields; } /** * {@inheritdoc} */ public function getIds() { /** * This method indicates what field(s) from the source row uniquely identify * that source row, and what their types are. This is critical information * for managing the migration. The keys of the returned array are the field * names from the query which comprise the unique identifier. The values are * arrays indicating the type of the field, used for creating compatible * columns in the map tables that track processed items. */ return [ 'style' => [ 'type' => 'string', // 'alias' is the alias for the table containing 'style' in the query // defined above. Optional in this case, but necessary if the same // column may occur in multiple tables in a join. 'alias' => 'met', ], ]; } }