You are here

public function FilePlain::query in Media Migration 8

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

src/Plugin/migrate/source/d7/FilePlain.php, line 87

Class

FilePlain
File Plain source plugin.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

public function query() {
  [
    'mime' => $mime,
    'scheme' => $scheme,
  ] = $this->configuration;
  $query = $this
    ->getFilePlainBaseQuery(NULL, FALSE);
  $query
    ->fields('fm');
  $query
    ->orderBy('fm.timestamp', 'ASC');
  if ($this->sourceHasFileEntities) {
    $query
      ->condition('fm.type', [
      'undefined',
      '',
    ], 'IN');
  }
  if ($mime) {
    $query
      ->where("{$this->getMainMimeTypeExpression()} = :mime", [
      ':mime' => $mime,
    ]);
  }
  if ($scheme) {
    $query
      ->where("{$this->getSchemeExpression()} = :scheme", [
      ':scheme' => $scheme,
    ]);
  }
  return $query;
}