Open ghost opened 8 years ago
@dleinbach Any news on this?
Hey @jhnferraris, I did my own hack and wrote the following function in the src/Task.php... Not sure if its the absoulte best way to do it but it seems to work.
public function insertSubTask(array $data)
{
$parent_task_id = empty($data['parent_task_id']) ? 0 : (int) $data['parent_task_id'];
if ($parent_task_id <= 0) {
throw new Exception('Required field parent_task_id');
}
if (!empty($data['files'])) {
$file = \TeamWorkPm\Factory::build('file');
$data['pending_file_attachments'] = $file->upload($data['files']);
unset($data['files']);
}
return $this->rest->post("tasks/$parent_task_id", $data);
}
then it can be called by doing something like this
public function addsubtask($id,$name,$date){
$task = TeamWorkPm::build('task');
$task_id = $task->insertSubTask(array(
'parent_task_id' => $id,
'content' => $name,
'notify' => false,
'description' => '',
'due_date' => date('Ymd', strtotime($date)),
'start_date' => date('Ymd'),
'private' => false,
'priority' => 'low',
'estimated_minutes' => 1000,
'responsible_party_id' => $this->TwId,
));
return 'subtask added';
}
Does your API framework allow the ability to add a subtask to a task? can you give an example if so?