You are here

protected function DrupalNode7Migration::query in Drupal-to-Drupal data migration 7.2

Query for basic node fields from Drupal 7.

Return value

QueryConditionInterface

Overrides DrupalMigration::query

2 calls to DrupalNode7Migration::query()
DrupalNode7Migration::prepareRow in d7/node.inc
Called after the query data is fetched - we'll use this to populate the source row with the CCK fields.
DrupalNode7Migration::__construct in d7/node.inc

File

d7/node.inc, line 57
Implementation of DrupalNodeMigration for Drupal 7 sources.

Class

DrupalNode7Migration
Handling specific to a Drupal 7 source for nodes.

Code

protected function query() {
  $query = Database::getConnection('default', $this->sourceConnection)
    ->select('node', 'n')
    ->fields('n', array(
    'nid',
    'vid',
    'language',
    'title',
    'uid',
    'status',
    'created',
    'changed',
    'comment',
    'promote',
    'sticky',
    'tnid',
    'translate',
  ))
    ->condition('n.type', $this->sourceType)
    ->orderBy($this->newOnly ? 'n.nid' : 'n.changed');

  // Join node_counter for Statistics support
  if ($this
    ->moduleExists('statistics')) {
    $query
      ->leftJoin('node_counter', 'nc', 'n.nid=nc.nid');
    $query
      ->addField('nc', 'daycount');
    $query
      ->addField('nc', 'timestamp');
    $query
      ->addField('nc', 'totalcount');
  }
  return $query;
}