function BookOutlineStorage::updateMovedChildren
Update the book ID of the book link that it's being moved.
Parameters
int $bid: The ID of the book whose children we move.
array $original: The original parent of the book link.
array $expressions: Array of expressions to be added to the query.
int $shift: The difference in depth between the old and the new position of the element being moved.
Return value
mixed The number of rows matched by the update query.
Overrides BookOutlineStorageInterface::updateMovedChildren
File
- 
              core/
modules/ book/ src/ BookOutlineStorage.php, line 154  
Class
- BookOutlineStorage
 - Defines a storage class for books outline.
 
Namespace
Drupal\bookCode
public function updateMovedChildren($bid, $original, $expressions, $shift) {
  $query = $this->connection
    ->update('book');
  $query->fields([
    'bid' => $bid,
  ]);
  foreach ($expressions as $expression) {
    $query->expression($expression[0], $expression[1], $expression[2]);
  }
  $query->expression('depth', '[depth] + :depth', [
    ':depth' => $shift,
  ]);
  $query->condition('bid', $original['bid']);
  $p = 'p1';
  for ($i = 1; !empty($original[$p]); $p = 'p' . ++$i) {
    $query->condition($p, $original[$p]);
  }
  return $query->execute();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.