Closed alexforte closed 3 years ago
Thanks for the suggestion. Could you submit a PR for suggested enhancement?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Prerequisites
master
branch of yii2-dynagrid.Steps to reproduce the issue
Expected behavior and actual behavior
I was expecting that DynaGridStore is stored in Cache because doesn't change so often.
Environment
Browsers
Operating System
Libraries
Isolating the problem
Possible Solution:
I found a solution that i want share with all community. In row 415 of DynaGridStore.php you can change to this:
// Original // $data = (new Query()) // ->select([$s['idAttr'], $s['nameAttr']]) // ->from($s['tableName']) // ->where([$s['dynaGridIdAttr'] => $this->_mstKey, $s['categoryAttr'] => $cat]) // ->all(Yii::$app->$connection);
// Fix Problem $data = Yii::$app->getDb()->cache(function ($connection) use ($s) { $data = (new Query()) ->select([$s['idAttr'], $s['nameAttr']]) ->from($s['tableName']) ->where([$s['dynaGridIdAttr'] => $this->_mstKey, $s['categoryAttr'] => $cat]) ->all($connection); return $data; });