public function saveConfig() { $config = new Config(); $conf = $config->findOne(['path' => 'newsletter.newsletterEnabled']); $conf->value = $this->isActive; $conf->save(); $conf = $config->findOne(['path' => 'newsletter.newsletterNotifyType']); $conf->value = $this->notifyType; $conf->save(); }
/** * Get parameter config model. * @param string $param parameter name including section. * @return Config */ public static function getConfig($param) { list($section, $name) = static::parseParamName($param); return Config::findOne(['name' => $name, 'section' => $section]); }
/** * Finds the Config model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $config_id * @return Config the loaded model * @throws HttpException if the model cannot be found */ protected function findModel($config_id) { if (($model = Config::findOne($config_id)) !== null) { return $model; } else { throw new HttpException(404, 'The requested page does not exist.'); } }