Clean up return value juggling in getNewestCommentList()

This commit is contained in:
Kijin Sung 2024-04-25 11:54:01 +09:00
parent 26fd165337
commit 9247e602b5

View file

@ -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;