You are here

public function BookOutlineStorage::insert in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/book/src/BookOutlineStorage.php \Drupal\book\BookOutlineStorage::insert()

Inserts a book link.

Parameters

array $link: The link array to be inserted in the database.

array $parents: The array of parent ids for the link to be inserted.

Return value

mixed The last insert ID of the query, if one exists.

Overrides BookOutlineStorageInterface::insert

File

core/modules/book/src/BookOutlineStorage.php, line 133
Contains \Drupal\book\BookOutlineStorage.

Class

BookOutlineStorage
Defines a storage class for books outline.

Namespace

Drupal\book

Code

public function insert($link, $parents) {
  return $this->connection
    ->insert('book')
    ->fields(array(
    'nid' => $link['nid'],
    'bid' => $link['bid'],
    'pid' => $link['pid'],
    'weight' => $link['weight'],
  ) + $parents)
    ->execute();
}