public function getTaskFromRequest($request = null) { if (!$request) { $request = $this->getRequest(); } $taskID = $request->latestParam('TaskID'); if ($taskID) { return TodoTask::get()->byID($taskID); } return TodoTask::create(); }
/** * The form handler for TaskForm * * @param array $rawData * @param Form $form * @param SS_HTTPRequest $request */ public function doAddTask($rawData, $form, $request) { $task = TodoTask::create(); $form->saveInto($task); $task->write(); $this->getTodoList()->Tasks()->add($task); $this->redirectBack(); }