You are here

public function DisqusCommentsStatus::query in Disqus 8

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

src/Plugin/migrate/source/DisqusCommentsStatus.php, line 48

Class

DisqusCommentsStatus
Disqus comments status.

Namespace

Drupal\disqus\Plugin\migrate\source

Code

public function query() {

  /** @var \Drupal\Core\Database\Query\SelectInterface $query */
  $query = $this
    ->select('node', 'n');
  $query
    ->condition('n.type', $this
    ->getEnabledTypes(), 'IN');
  $query
    ->orderBy('n.nid');
  $query
    ->leftJoin('disqus', 'd', 'd.nid=n.nid');
  $query
    ->addField('n', 'nid', 'nid');

  // No entry in {disqus} table means status == 1.
  $query
    ->addExpression('IF(d.status IS NULL, 1, d.status)', 'status');
  return $query;
}