- ⌂ System Task
- Methods
- Static Methods
SystemTask::set_canceling()
Attempts to set the state of the System Task to canceling with an optional free-form reason. If the optional reason is specified, it will be logged as an error.
Prototype
boolean set_canceling(string $reason = '')
Return
Returns TRUE if the System Task state could be changed to canceling. Otherwise FALSE.
Example
/**
* Check an HTTP request to see if we should cancel a process,
* and then gracefully cancel the process if requested.
*/
$request = new \io_comand_web\request();
if($request->get('cancel')) {
$task_oid = $request->get('toid');
$repo = comand::repo();
$task = $repo->get_object_by_oid($task_oid, 'SystemTask');
if($task && $task->Title == 'My Process') {
$task->set_canceling('Cancelled by web user.');
}
}