You are here

public function Workflow::delete in Workflow 7.2

Same name and namespace in other branches
  1. 7 includes/Entity/Workflow.php \Workflow::delete()

Given a wid, delete the workflow and its data.

@deprecated: workflow_delete_workflows_by_wid() --> Workflow::delete().

Overrides Entity::delete

File

includes/Entity/Workflow.php, line 234
Contains workflow\includes\Entity\Workflow. Contains workflow\includes\Entity\WorkflowController.

Class

Workflow

Code

public function delete() {
  $wid = $this->wid;

  // Notify any interested modules before we delete the workflow.
  // E.g., Workflow Node deletes the {workflow_type_map} record.
  module_invoke_all('workflow', 'workflow delete', $wid, NULL, NULL, FALSE);

  // Delete associated state (also deletes any associated transitions).
  foreach ($this
    ->getStates($all = TRUE) as $state) {
    $state
      ->deactivate(0);
    $state
      ->delete();
  }

  // Delete the workflow.
  db_delete('workflows')
    ->condition('wid', $wid)
    ->execute();
}