コード例 #1
0
 public function ExeDelete($PostId)
 {
     $this->Post = (int) $PostId;
     $ReadPost = new WsPosts();
     $ReadPost->setPost_id($this->Post);
     $ReadPost->find();
     if (!$ReadPost->getResult()) {
         $this->Error = ['O post que você tentou deletar não existe no sistema!', WS_ERROR];
         $this->Result = false;
     } else {
         $PostDelete = $ReadPost->getResult();
         $this->deletaImagem('../uploads/' . $PostDelete->post_cover);
         $this->deletaGallery();
         $ReadPost->setPost_id($this->Post);
         $ReadPost->delete();
         $this->Error = ["O post <b>{$PostDelete->post_title}</b> foi removido com sucesso do sistema!", WS_ACCEPT];
     }
 }