public function __construct() { $cache = Yii::$app->cache; $this->data = $cache->get('settings'); if ($this->data === false) { $items = Settings::find()->all(); foreach ($items as $item) { if ($item->param) { $this->data[$item->group][$item->param] = $item->value == null ? $item->default : $item->value; } } $cache->set('settings', $this->data, defined("YII_DEBUG") && YII_DEBUG ? 1 : 3600); } }
/** Переменные **/ public function actionPeremen() { $dataProvider = new ActiveDataProvider(['query' => Settings::find()->joinWith('grouping')->orderBy('setting_group.position,position'), 'pagination' => ['pageSize' => 10000]]); return $this->render('peremen', ['dataProvider' => $dataProvider]); }