src/Controller/TaskRunnerController.php
public function deleteTaskAction($taskId)
    {
        $list = $this->getTensideTasks();
        $task = $list->getTask($taskId);

        if (!$task) {
            throw new NotFoundHttpException('Task id ' . $taskId . ' not found');
        }

        if ($task->getStatus() === Task::STATE_RUNNING) {
            throw new NotAcceptableHttpException('Task id ' . $taskId . ' is running and can not be deleted');
        }

        $task->removeAssets();
        $list->remove($task->getId());

        return JsonResponse::create(
            [
                'status' => 'OK'
            ]
        );
    }
public function deleteTaskAction($taskId)
    {
        $list = $this->getTensideTasks();
        $task = $list->getTask($taskId);

        if (!$task) {
            throw new NotFoundHttpException('Task id ' . $taskId . ' not found');
        }

        if ($task->getStatus() === Task::STATE_RUNNING) {
            throw new NotAcceptableHttpException('Task id ' . $taskId . ' is running and can not be deleted');
        }

        $task->removeAssets();
        $list->remove($task->getId());

        return JsonResponse::create(
            [
                'status' => 'OK'
            ]
        );
    }
public function deleteTaskAction ( $ taskId ) { $ list = $ this -> getTensideTasks ( ) ; $ task = $ list -> getTask ( $ taskId ) ; if ( ! $ task ) { throw new NotFoundHttpException ( 'Task id ' . $ taskId . ' not found' ) ; } if ( $ task -> getStatus ( ) === Task :: STATE_RUNNING ) { throw new NotAcceptableHttpException ( 'Task id ' . $ taskId . ' is running and can not be deleted' ) ; } $ task -> removeAssets ( ) ; $ list -> remove ( $ task -> getId ( ) ) ; return JsonResponse :: create ( [ 'status' => 'OK' ] ) ; }
Remove a task from the list.

@param string $taskId The id of the task to remove.

@return JsonResponse

@throws NotFoundHttpException      When the given task could not be found.
@throws NotAcceptableHttpException When trying to delete a running task.

@ApiDoc(
section="tasks",
statusCodes = {
200 = "When everything worked out ok"
},
authentication = true,
authenticationRoles = {
"ROLE_MANIPULATE_REQUIREMENTS"
},
)
@ApiDescription(
response={
"status" = {
"dataType" = "string",
"description" = "OK on success"
}
}
)
Remove a task from the list .