public function Book::query in Drupal 8
Same name and namespace in other branches
- 9 core/modules/book/src/Plugin/migrate/source/Book.php \Drupal\book\Plugin\migrate\source\Book::query()
Return value
\Drupal\Core\Database\Query\SelectInterface
Overrides SqlBase::query
File
- core/
modules/ book/ src/ Plugin/ migrate/ source/ Book.php, line 20
Class
- Book
- Drupal 6 and 7 book source.
Namespace
Drupal\book\Plugin\migrate\sourceCode
public function query() {
$query = $this
->select('book', 'b')
->fields('b', [
'nid',
'bid',
]);
$query
->join('menu_links', 'ml', 'b.mlid = ml.mlid');
$ml_fields = [
'mlid',
'plid',
'weight',
'has_children',
'depth',
];
foreach (range(1, 9) as $i) {
$field = "p{$i}";
$ml_fields[] = $field;
$query
->orderBy('ml.' . $field);
}
return $query
->fields('ml', $ml_fields);
}