You are here

public function Book::query in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/Plugin/migrate/source/d6/Book.php \Drupal\book\Plugin\migrate\source\d6\Book::query()

Return value

\Drupal\Core\Database\Query\SelectInterface

Overrides SqlBase::query

File

core/modules/book/src/Plugin/migrate/source/d6/Book.php, line 24
Contains \Drupal\book\Plugin\migrate\source\d6\Book.

Class

Book
Drupal 6 book source.

Namespace

Drupal\book\Plugin\migrate\source\d6

Code

public function query() {
  $query = $this
    ->select('book', 'b')
    ->fields('b', array(
    'nid',
    'bid',
  ));
  $query
    ->join('menu_links', 'ml', 'b.mlid = ml.mlid');
  $ml_fields = array(
    'mlid',
    'plid',
    'weight',
    'has_children',
    'depth',
  );
  for ($i = 1; $i <= 9; $i++) {
    $field = "p{$i}";
    $ml_fields[] = $field;
    $query
      ->orderBy($field);
  }
  $query
    ->fields('ml', $ml_fields);
  return $query;
}