public function loadModel() { $rows = Config::findAll(['scope' => $this->scope]); foreach ($rows as $row) { $id = $row['id']; $this->{$id} = $row['value']; } }
public static function createConfigCache() { self::createCacheFile(); $content = '<?php' . self::$newLine; $dataList = Config::findAll(); foreach ($dataList as $row) { $id = $row['id']; $content .= '$cachedConfigs[\'' . $row['id'] . '\']=[' . self::$newLine; $content .= self::getCacheItem('id', $row); $content .= self::getCacheItem('scope', $row); $content .= self::getCacheItem('value', $row); $content .= self::getCacheItem('note', $row); $content .= "];" . self::$newLine; } self::writeFile('cachedConfigs.php', $content); }