/** * Loads settings for section * @param string $section * @return SettingForm */ public function loadBySection($section = 'general') { $models = Setting::find()->where(['section' => $section])->indexBy('key')->orderBy('position ASC')->all(); if (!empty($models)) { $this->_settingModels = $models; return true; } return false; }
/** * Migration down * @return bool */ public function safeDown() { foreach ($this->_rows as $row) { $command = $this->db->createCommand()->delete(Setting::tableName(), ['section' => $row['section'], 'key' => $row['key']]); if (!$command->execute()) { echo "Error, position not updated!\n"; return false; } } return true; }