From f954f79250b5acf797eb0b97d34453105e5fe47b Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Tue, 27 Jan 2015 17:43:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BB-=D0=B2=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D0=B8=D1=81=D0=B5=D0=B9=20SqlModel::count=20MIRSPO?= =?UTF-8?q?RTA-604=20=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20mys?= =?UTF-8?q?ql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Model/SqlModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/SqlModel.php b/Model/SqlModel.php index 669f6e7..047332e 100644 --- a/Model/SqlModel.php +++ b/Model/SqlModel.php @@ -231,10 +231,10 @@ abstract class SqlModel extends Model $where = $this->db->whereExpr($where); $group_by = $this->db->groupByExpr($group_by); $result = $this->query( - 'SELECT ' . $select_parent_query . ' FROM (' . + 'SELECT (' . (($sql_expression) ? $sql_expression : ('SELECT * FROM ' . $this->identify($this->table()))) . (($where) ? (' WHERE ' . $where) : '') - . (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS x', + . (($group_by) ? (' GROUP BY ' . $group_by) : '') . ') AS count', $sql_expression_params, $cache_key );