function Node::query

Same name in this branch
  1. 9 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::query()
Same name in other branches
  1. 8.9.x core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::query()
  2. 8.9.x core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::query()
  3. 10 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::query()
  4. 10 core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::query()
  5. 11.x core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::query()
  6. 11.x core/modules/node/src/Plugin/migrate/source/d7/Node.php \Drupal\node\Plugin\migrate\source\d7\Node::query()

Overrides SqlBase::query

1 call to Node::query()
NodeComplete::query in core/modules/node/src/Plugin/migrate/source/d7/NodeComplete.php
1 method overrides Node::query()
NodeComplete::query in core/modules/node/src/Plugin/migrate/source/d7/NodeComplete.php

File

core/modules/node/src/Plugin/migrate/source/d7/Node.php, line 89

Class

Node
Drupal 7 node source from database.

Namespace

Drupal\node\Plugin\migrate\source\d7

Code

public function query() {
    // Select node in its last revision.
    $query = $this->select('node_revision', 'nr')
        ->fields('n', [
        'nid',
        'type',
        'language',
        'status',
        'created',
        'changed',
        'comment',
        'promote',
        'sticky',
        'tnid',
        'translate',
    ])
        ->fields('nr', [
        'vid',
        'title',
        'log',
        'timestamp',
    ]);
    $query->addField('n', 'uid', 'node_uid');
    $query->addField('nr', 'uid', 'revision_uid');
    $query->innerJoin('node', 'n', static::JOIN);
    // If the content_translation module is enabled, get the source langcode
    // to fill the content_translation_source field.
    if ($this->moduleHandler
        ->moduleExists('content_translation')) {
        $query->leftJoin('node', 'nt', '[n].[tnid] = [nt].[nid]');
        $query->addField('nt', 'language', 'source_langcode');
    }
    $this->handleTranslations($query);
    if (isset($this->configuration['node_type'])) {
        $query->condition('n.type', (array) $this->configuration['node_type'], 'IN');
    }
    return $query;
}

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