You are here

public function BeerTerm::query in Migrate Plus 8.2

Same name and namespace in other branches
  1. 8.5 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::query()
  2. 8 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::query()
  3. 8.3 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::query()
  4. 8.4 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

migrate_example/src/Plugin/migrate/source/BeerTerm.php, line 27

Class

BeerTerm
This is an example of a simple SQL-based source plugin. Source plugins are classes which deliver source data to the processing pipeline. For SQL sources, the SqlBase class provides most of the functionality needed - for a specific migration, you are…

Namespace

Drupal\migrate_example\Plugin\migrate\source

Code

public function query() {

  /**
   * The most important part of a SQL source plugin is the SQL query to
   * retrieve the data to be imported. Note that the query is not executed
   * here - the migration process will control execution of the query. Also
   * note that it is constructed from a $this->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',
  ])
    ->orderBy('style_parent', 'ASC');
}