function SqlBase::prepareQuery

Same name in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/migrate/source/SqlBase.php \Drupal\migrate\Plugin\migrate\source\SqlBase::prepareQuery()
  2. 10 core/modules/migrate/src/Plugin/migrate/source/SqlBase.php \Drupal\migrate\Plugin\migrate\source\SqlBase::prepareQuery()
  3. 11.x core/modules/migrate/src/Plugin/migrate/source/SqlBase.php \Drupal\migrate\Plugin\migrate\source\SqlBase::prepareQuery()

Adds tags and metadata to the query.

Return value

\Drupal\Core\Database\Query\SelectInterface The query with additional tags and metadata.

1 call to SqlBase::prepareQuery()
SqlBase::initializeIterator in core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
Initializes the iterator with the source data.

File

core/modules/migrate/src/Plugin/migrate/source/SqlBase.php, line 241

Class

SqlBase
Sources whose data may be fetched via a database connection.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

protected function prepareQuery() {
    $this->query = clone $this->query();
    $this->query
        ->addTag('migrate');
    $this->query
        ->addTag('migrate_' . $this->migration
        ->id());
    $this->query
        ->addMetaData('migration', $this->migration);
    return $this->query;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.