You are here

public function FieldInstance::query in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/field/src/Plugin/migrate/source/d6/FieldInstance.php \Drupal\field\Plugin\migrate\source\d6\FieldInstance::query()
  2. 8 core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php \Drupal\field\Plugin\migrate\source\d7\FieldInstance::query()
Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php \Drupal\field\Plugin\migrate\source\d7\FieldInstance::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php, line 25
Contains \Drupal\field\Plugin\migrate\source\d7\FieldInstance.

Class

FieldInstance
Drupal 7 field instances source from database.

Namespace

Drupal\field\Plugin\migrate\source\d7

Code

public function query() {
  $query = $this
    ->select('field_config_instance', 'fci')
    ->fields('fci')
    ->condition('fci.deleted', 0)
    ->condition('fc.active', 1)
    ->condition('fc.deleted', 0)
    ->condition('fc.storage_active', 1)
    ->fields('fc', array(
    'type',
  ));
  $query
    ->innerJoin('field_config', 'fc', 'fci.field_id = fc.id');

  // Optionally filter by entity type and bundle.
  if (isset($this->configuration['entity_type'])) {
    $query
      ->condition('entity_type', $this->configuration['entity_type']);
    if (isset($this->configuration['bundle'])) {
      $query
        ->condition('bundle', $this->configuration['bundle']);
    }
  }
  return $query;
}