From 9247e602b55519dc0fbbef7dd7c76d939d422669 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 25 Apr 2024 11:54:01 +0900 Subject: [PATCH] Clean up return value juggling in getNewestCommentList() --- modules/comment/comment.model.php | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 1cb80d1ca..ab309686f 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -451,36 +451,21 @@ class CommentModel extends Comment } } - $output = executeQuery('comment.getNewestCommentList', $args, $columnList); - + $output = executeQueryArray('comment.getNewestCommentList', $args, $columnList); if(!$output->toBool()) { return $output; } - $comment_list = $output->data; - if($comment_list) + $result = []; + foreach ($output->data as $key => $attribute) { - if(!is_array($comment_list)) + if ($attribute->comment_srl) { - $comment_list = array($comment_list); - } - - $result = []; - foreach($comment_list as $key => $attribute) - { - if(!$attribute->comment_srl) - { - continue; - } - - $oComment = NULL; - $oComment = new commentItem(); + $oComment = new CommentItem(); $oComment->setAttribute($attribute); - $result[$key] = $oComment; } - $output->data = $result; } return $result;