/** * load conditions to item * * @param Task $item */ private function loadConditions(&$item) { $item->deleteAllConditions(); $conditions = $this->database->table("TaskConditions")->where("TaskID", $item->id); foreach ($conditions as $condition_data) { $class = "Mepatek\\TaskManager\\Entity\\TaskCondition_" . $condition_data->Type; $condition = new $class(); $condition->id = $condition_data->TaskConditionID; $condition->data = $condition_data->Data; $condition->created = $condition_data->Created; $condition->expired = $condition_data->Expired; $condition->active = $condition_data->Active; $item->addCondition($condition); } }
/** * Set state to idle * set last and next run * * @param Task $task */ protected function setTaskIdleAndSave(Task $task) { // set state idle $task->setLastAndNextRun(); $task->exceedDateTime = null; $task->state = 0; $this->taskRepository->save($task); }