You are here

public function WorkflowRepository::update in Forms Steps 8

Update an entry in the database.

Parameters

array $entry: An array containing all the fields of the item to be updated.

Return value

int The number of updated rows.

See also

db_update()

File

src/Repository/WorkflowRepository.php, line 90

Class

WorkflowRepository
Class WorkflowRepository.

Namespace

Drupal\forms_steps\Repository

Code

public function update(array $entry) {
  try {

    // Connection->update()...->execute() returns the number of rows updated.
    $count = $this->connection
      ->update(self::FORMS_STEPS_WORKFLOW_DB)
      ->fields($entry)
      ->condition('id', $entry['id'])
      ->execute();
  } catch (\Exception $e) {
    $this
      ->messenger()
      ->addMessage($this
      ->t('db_update failed. Message = %message, query= %query', [
      '%message' => $e
        ->getMessage(),
      '%query' => $e->query_string,
    ]), 'error');
  }
  return $count;
}