You are here

public function FieldCollectionItem::query in Paragraphs 8

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

src/Plugin/migrate/source/d7/FieldCollectionItem.php, line 39

Class

FieldCollectionItem
Field Collection Item source plugin.

Namespace

Drupal\paragraphs\Plugin\migrate\source\d7

Code

public function query() {
  $query = $this
    ->select('field_collection_item', 'f')
    ->fields('f', [
    'item_id',
    'field_name',
    'archived',
  ])
    ->fields('fr', [
    'revision_id',
  ]);
  $query
    ->innerJoin('field_collection_item_revision', 'fr', static::JOIN);

  // This configuration item may be set by a deriver to restrict the
  // bundles retrieved.
  if ($this->configuration['field_name']) {
    $query
      ->condition('f.field_name', $this->configuration['field_name']);
    $query
      ->addField('fc', 'entity_type', 'parent_type');
    $query
      ->addField('fc', 'entity_id', 'parent_id');
    $query
      ->innerJoin('field_revision_' . $this->configuration['field_name'], 'fc', 'fc.' . $this->configuration['field_name'] . '_value = f.item_id and fc.' . $this->configuration['field_name'] . '_revision_id = f.revision_id');
  }
  return $query;
}