You are here

public function WorkflowScheduledTransition::save in Workflow 7

Same name and namespace in other branches
  1. 7.2 includes/Entity/WorkflowScheduledTransition.php \WorkflowScheduledTransition::save()

File

includes/Entity/WorkflowScheduledTransition.php, line 90
Contains workflow\includes\Entity\WorkflowScheduledTransition.

Class

WorkflowScheduledTransition

Code

public function save() {

  // Avoid duplicate entries.
  $this
    ->delete();

  // Save (insert or update) a record to the database based upon the schema.
  drupal_write_record('workflow_scheduled_transition', $this);

  // Get name of state.
  if ($state = WorkflowState::load($this->new_sid)) {
    $message = '@entity_title scheduled for state change to %state_name on %scheduled_date';
    $args = array(
      '@entity_type' => $this->entity_type,
      '@entity_title' => $this->entity->title,
      '%state_name' => t($state
        ->label()),
      '%scheduled_date' => format_date($this->scheduled),
    );
    $uri = entity_uri($this->entity_type, $this->entity);
    watchdog('workflow', $message, $args, WATCHDOG_NOTICE, l('view', $uri['path'] . '/workflow'));
    drupal_set_message(t($message, $args));
  }
}