Exemple #1
0
 public function deleteCommentModel($commentId)
 {
     $responseDTO = new ResponseDTO(DELETE_COMMENT_FORM);
     try {
         $postDAO = new PostDAO();
         $deletedComment = $postDAO->deleteComment($commentId);
         if ($deletedComment != 1) {
             $responseDTO->setErrField(ERROR_RESPONSE, "Errore durante l'eliminazione del commento");
             $responseDTO->setSubElementId($commentId);
         } else {
             if (isset($_POST[JAVASCRIPT_ON]) && $_POST[JAVASCRIPT_ON] === "Y") {
                 $responseDTO->setResponseSucc("#comment" . $commentId);
             } else {
                 $responseDTO->setResponseSucc("Commento eliminato con successo!");
             }
         }
         return $responseDTO;
     } catch (PDOException $pdoe) {
         throw $pdoe;
     } catch (UserNotAuthenticatedExceptionDTO $authExp) {
         throw $authExp;
     } catch (Exception $e) {
         throw $e;
     }
 }