You are here

protected function DrupalComment5Migration::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

d5/comment.inc, line 45
Implementation of DrupalCommentMigration for Drupal 5 sources.

Class

DrupalComment5Migration
Handling specific to a Drupal 5 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;
}