function BookOutlineStorage::updateMovedChildren

Same name in other branches
  1. 8.9.x core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::updateMovedChildren()
  2. 10 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::updateMovedChildren()
  3. 11.x core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::updateMovedChildren()

Overrides BookOutlineStorageInterface::updateMovedChildren

File

core/modules/book/src/BookOutlineStorage.php, line 154

Class

BookOutlineStorage
Defines a storage class for books outline.

Namespace

Drupal\book

Code

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.