Updates string object in the database.
Drupal\locale\StringInterface $string: The string object.
bool|int If the record update failed, returns FALSE. If it succeeded, returns SAVED_NEW or SAVED_UPDATED.
Drupal\locale\StringStorageException If the string is not suitable for this storage, an exception is thrown.
protected function dbStringUpdate($string) {
if (($table = $this
->dbStringTable($string)) && ($keys = $this
->dbStringKeys($string, $table)) && ($fields = $this
->dbStringValues($string, $table)) && ($values = array_diff_key($fields, $keys))) {
return $this->connection
->merge($table, $this->options)
->key($keys)
->fields($values)
->execute();
}
else {
throw new StringStorageException(format_string('The string cannot be updated: @string', array(
'@string' => $string
->getString(),
)));
}
}