You are here

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

Implementation of DrupalCommentMigration::query().

We join to {node} so that we can use separate comment migration classes for each associated node type.

Return value

SelectQueryInterface

Overrides DrupalMigration::query

File

d6/comment.inc, line 46
Implementation of DrupalCommentMigration for Drupal 6 sources.

Class

DrupalComment6Migration
Handling specific to a Drupal 6 source for comments.

Code

protected function query() {
  $query = Database::getConnection('default', $this->sourceConnection)
    ->select('comments', 'c')
    ->fields('c', array(
    'cid',
    'pid',
    'nid',
    'uid',
    'subject',
    'comment',
    'hostname',
    'timestamp',
    'status',
    'thread',
    'name',
    'mail',
    'homepage',
    'format',
  ));
  $query
    ->join('node', 'n', 'c.nid = n.nid');
  $query
    ->condition('n.type', $this->sourceType)
    ->orderBy($this->newOnly ? 'c.cid' : 'c.timestamp');
  return $query;
}