public function deletePost($args) { if (!isset($args["postId"])) { return $this->io->badRequest("Post id was missing"); } $mediaIO = new MediaIO($this->io); $mediaIO->deleteMediaForPost($args); $query = "DELETE FROM comment WHERE post_id = :id; DELETE FROM post WHERE post_id = :id"; $bindings = []; $bindings[":id"] = $args["postId"]; $results = $this->io->queryDB($args, $query, $bindings); if ($results["data"] > 0) { $results["meta"]["status"] = 200; $results["meta"]["message"] = "Post was deleted"; } return $results; }
$args["messageId"] = $path[1]; } switch ($verb) { case "GET": $results = $messageIO->getMessages($args); break; case "POST": $results = $messageIO->createMessage($args); break; default: $results = $io->methodNotAllowed($args); break; } break; case "media": $mediaIO = new MediaIO($io); switch ($verb) { case "GET": $results = $mediaIO->getMedia($args); break; default: $results = $io->methodNotAllowed($args); break; } break; default: $results = $io->methodNotAllowed($args); break; } //If data or debug is not set then it is set to an empty array if (!isset($results["data"])) {