From 2c4e84a7db2cc96f2e8bc936a82b8e07e913c26a Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 24 Jan 2018 06:39:37 +0100 Subject: [PATCH] Check if a commen exists --- classes/components/comments.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/classes/components/comments.php b/classes/components/comments.php index 9e931e6..b603110 100644 --- a/classes/components/comments.php +++ b/classes/components/comments.php @@ -51,6 +51,18 @@ class Comments { } + /** + * Check if a comment exists or not + * + * @param int $commentID The ID of the comment to check + * @return bool + */ + public function exists(int $commentID) : bool { + + return CS::get()->db->count($this::COMMENTS_TABLE, "WHERE ID = ?", array($commentID)) > 0; + + } + /** * Parse a comment informations *