From 1ff1c65724d301fc7c39ae66bcb864606b76ec36 Mon Sep 17 00:00:00 2001 From: lav45 Date: Sun, 16 Jun 2024 19:30:58 +0300 Subject: [PATCH] Remove cache \yii\data\ActiveDataProvider::prepareTotalCount() --- framework/data/ActiveDataProvider.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/framework/data/ActiveDataProvider.php b/framework/data/ActiveDataProvider.php index 357b1eb74ef..1a098cd6474 100644 --- a/framework/data/ActiveDataProvider.php +++ b/framework/data/ActiveDataProvider.php @@ -151,8 +151,6 @@ protected function prepareKeys($models) return array_keys($models); } - private $_totalCount = []; - /** * {@inheritdoc} */ @@ -161,13 +159,8 @@ protected function prepareTotalCount() if (!$this->query instanceof QueryInterface) { 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)->limit(-1)->offset(-1)->orderBy([]); - $key = md5((string)$query); - - if (!array_key_exists($key, $this->_totalCount)) { - $this->_totalCount[$key] = (int)$query->count('*', $this->db); - } - return $this->_totalCount[$key]; + $query = clone $this->query; + return (int) $query->limit(-1)->offset(-1)->orderBy([])->count('*', $this->db); } /**