public function deleteAction() { $articleId = (int) $this->_getParam('id'); if ($articleId == 0) { throw new VC_Exception("Invalid article delete information"); } //Check if this article belong with this user $articleTbl = new VC_DbTable_Store_Article(); $article = $articleTbl->findByIdAndUserId($articleId, $this->userId); if ($article) { //Delete $articleTbl->delete("id = " . $articleId); $this->_redirect("article/view/?tpid=" . $this->_getParam("tpid")); } else { throw new VC_Exception("This article not belong with you"); } }
public function deleteByTopicId($topicId) { $articleTbl = new VC_DbTable_Store_Article(); $articleTbl->delete("topic_id = " . $topicId); $this->delete("id = " . $topicId); }