1 config.inc | public ConfigDatabaseStorage::rename($name, $new_name) |
Renames a configuration object in the storage.
Parameters
string $name: The name of a configuration object to rename.
string $new_name: The new name of a configuration object.
Return value
bool: TRUE on success, FALSE otherwise.
Overrides ConfigStorageInterface::rename
File
- core/
includes/ config.inc, line 1472 - This is the API for configuration storage.
Class
- ConfigDatabaseStorage
- Defines the database storage controller.
Code
public function rename($name, $new_name) {
try {
db_delete($this->table, array('target' => $this->database))
->condition('name', $new_name)
->execute();
db_update($this->table, array('target' => $this->database))
->fields(array('name' => $new_name))
->condition('name', $name)
->execute();
}
catch (\Exception $e) {
throw new ConfigStorageException('Failed to rename configuration from: ' . $name . ' to: ' . $new_name, 0, $e);
}
return TRUE;
}