doDeleteMultiple example

protected function purgeMultiple(array $ids) {
    $loaded = $this->loadFullMultiple($ids);
    foreach ($loaded as $id => $link) {
      if ($link['has_children']) {
        $children = $this->loadByProperties(['parent' => $id]);
        foreach ($children as $child) {
          $child['parent'] = $link['parent'];
          $this->save($child);
        }
      }
    }
    $this->doDeleteMultiple($ids);
  }

  /** * Executes a select query while making sure the database table exists. * * @param \Drupal\Core\Database\Query\SelectInterface $query * The select object to be executed. * * @return \Drupal\Core\Database\StatementInterface|null * A prepared statement, or NULL if the query is not valid. * * @throws \Exception * Thrown if the table could not be created or the database connection * failed. */
Home | Imprint | This part of the site doesn't use cookies.