You are here

public function FilePlainConfigSourceBase::query in Media Migration 8

1 call to FilePlainConfigSourceBase::query()
FilePlainSourceFieldInstance::query in src/Plugin/migrate/source/d7/FilePlainSourceFieldInstance.php
1 method overrides FilePlainConfigSourceBase::query()
FilePlainSourceFieldInstance::query in src/Plugin/migrate/source/d7/FilePlainSourceFieldInstance.php

File

src/Plugin/migrate/source/d7/FilePlainConfigSourceBase.php, line 76

Class

FilePlainConfigSourceBase
Base class for config migrate source plugins of plain file migrations.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

public function query() {
  [
    'mimes' => $mimes,
    'schemes' => $schemes,
  ] = $this->configuration;
  $query = $this
    ->getFilePlainBaseQuery();
  if ($this->sourceHasFileEntities) {
    $query
      ->condition('fm.type', [
      'undefined',
      '',
    ], 'IN');
  }
  if ($mimes) {
    $query
      ->where("{$this->getMainMimeTypeExpression()} IN (:mimes[])", [
      ':mimes[]' => explode(static::MULTIPLE_SEPARATOR, $mimes),
    ]);
  }
  if ($schemes) {
    $query
      ->where("{$this->getSchemeExpression()} IN (:schemes[])", [
      ':schemes[]' => explode(static::MULTIPLE_SEPARATOR, $schemes),
    ]);
  }
  return $query;
}