public function Book::query in Drupal 10
Same name and namespace in other branches
- 8 core/modules/book/src/Plugin/migrate/source/Book.php \Drupal\book\Plugin\migrate\source\Book::query()
- 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 25
Class
- Book
- Drupal 6/7 book source from database.
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);
}