You are here

public function NodeStorage::updateType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/NodeStorage.php \Drupal\node\NodeStorage::updateType()

Updates all nodes of one type to be of another type.

Parameters

string $old_type: The current node type of the nodes.

string $new_type: The new node type of the nodes.

Return value

int The number of nodes whose node type field was modified.

Overrides NodeStorageInterface::updateType

File

core/modules/node/src/NodeStorage.php, line 52
Contains \Drupal\node\NodeStorage.

Class

NodeStorage
Defines the controller class for nodes.

Namespace

Drupal\node

Code

public function updateType($old_type, $new_type) {
  return $this->database
    ->update('node')
    ->fields(array(
    'type' => $new_type,
  ))
    ->condition('type', $old_type)
    ->execute();
}