diff options
Diffstat (limited to 'src/Bridge.php')
-rw-r--r-- | src/Bridge.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Bridge.php b/src/Bridge.php index d9f0dec..b137b51 100644 --- a/src/Bridge.php +++ b/src/Bridge.php @@ -126,6 +126,18 @@ class Bridge { } } + public function removePost($postId) { + throw_if_null($postId); + + $sql = 'DELETE FROM posts WHERE post_id = ' . $postId; + + $count = $this->db->exec($sql); + + if ($count < 1) { + throw new Exception('Failed to delete post id: ' . $postId); + } + } + protected function get_exactly_one_row($sql) { $result = $this->db->query($sql); |