/** * GET /issues/copy/@id * Copy an issue * * @param \Base $f3 * @param array $params * @throws \Exception */ public function copy($f3, $params) { $issue = new \Model\Issue(); $issue->load($params["id"]); if (!$issue->id) { $f3->error(404, "Issue does not exist"); return; } $new_issue = $issue->duplicate(); if ($new_issue->id) { $f3->reroute("/issues/" . $new_issue->id); } else { $f3->error(500, "Failed to duplicate issue."); } }