public function deleteAction($request, $db) { if (!isset($request->user_id)) { throw new Exception("You must be logged in to delete data", 400); } if (isset($request->url_elements[4])) { switch ($request->url_elements[4]) { case 'attending': $event_id = $this->getItemId($request); $event_mapper = new EventMapper($db, $request); $event_mapper->setUserNonAttendance($event_id, $request->user_id); header("Location: " . $request->base . $request->path_info, null, 200); return; break; default: throw new Exception("Operation not supported, sorry", 404); } } else { throw new Exception("Operation not supported, sorry", 404); } }