From ced7ee1b8ab3c228719b88295066396e564a5973 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 13 Nov 2013 19:47:35 +0100 Subject: [PATCH] dataprovider: reset orderBy when counting strict sql dbms like postgres would fail otherwise --- framework/yii/data/ActiveDataProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/yii/data/ActiveDataProvider.php b/framework/yii/data/ActiveDataProvider.php index 3766692..a8bb18f 100644 --- a/framework/yii/data/ActiveDataProvider.php +++ b/framework/yii/data/ActiveDataProvider.php @@ -158,7 +158,7 @@ class ActiveDataProvider extends BaseDataProvider throw new InvalidConfigException('The "query" property must be an instance of a class that implements the QueryInterface e.g. yii\db\Query or its subclasses.'); } $query = clone $this->query; - return (int) $query->limit(-1)->offset(-1)->count($this->db); + return (int) $query->limit(-1)->offset(-1)->orderBy([])->count($this->db); } /**