function Book::query
Same name in other branches
- 9 core/modules/book/src/Plugin/migrate/source/Book.php \Drupal\book\Plugin\migrate\source\Book::query()
- 8.9.x core/modules/book/src/Plugin/migrate/source/Book.php \Drupal\book\Plugin\migrate\source\Book::query()
- 11.x core/modules/book/src/Plugin/migrate/source/Book.php \Drupal\book\Plugin\migrate\source\Book::query()
Overrides SqlBase::query
File
-
core/
modules/ book/ src/ Plugin/ migrate/ source/ Book.php, line 27
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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.