From a52c17e6ff8df4286f7da1774e60eb24006197a3 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 23 Apr 2023 01:16:28 +0200 Subject: [PATCH] fix missing count only condition --- src/Utils.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Utils.php b/src/Utils.php index f8a0b84..c7f95a2 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -66,7 +66,7 @@ class Utils $sql = $ext_sql ? clone $ext_sql : new SelectStatement(); if ($count_only) { - $sql->column($sql->count($sql->unique('T.periodical_id'))); + $sql->column($sql->count('T.periodical_id')); } else { if (!empty($params['columns']) && is_array($params['columns'])) { $sql->columns($params['columns']); @@ -259,8 +259,8 @@ class Utils $params['sql'] = ''; } - $sql - ->columns([ + if (!$count_only) { + $sql->columns([ 'T.periodical_id', 'T.periodical_title', 'T.periodical_type', @@ -269,7 +269,9 @@ class Utils 'T.periodical_pub_int', 'T.periodical_pub_nb', - ]) + ]); + } + $sql ->join( (new JoinStatement()) ->left()