You are here

public function BeerTerm::query in Migrate Plus 8.5

Same name and namespace in other branches
  1. 8 migrate_example/src/Plugin/migrate/source/BeerTerm.php \Drupal\migrate_example\Plugin\migrate\source\BeerTerm::query()
  2. 8.2 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 28

Class

BeerTerm
This is an example of a simple SQL-based source plugin.

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.
  $fields = [
    'style',
    'details',
    'style_parent',
    'region',
    'hoppiness',
  ];
  return $this
    ->select('migrate_example_beer_topic', 'met')
    ->fields('met', $fields)
    ->orderBy('style_parent', 'ASC');
}