/** * Lists all DefineTable models. * * @return mixed */ public function actionIndex() { $rows = DefineTable::findAll(); $locals = []; $locals['rows'] = $rows; return $this->render('index', $locals); }
public static function createFieldCache() { self::createCacheFile(); $content = '<?php' . self::$newLine; $tables = DefineTable::findAll(); foreach ($tables as $table) { $tableName = $table['table_name']; $dataList = DefineTableField::findAll(['table' => $tableName]); foreach ($dataList as $row) { $content .= '$cachedFields[\'' . $tableName . '\'][\'' . $row['field_name'] . '\']=[' . self::$newLine; $content .= self::getCacheItem('id', $row, 'int'); $content .= self::getCacheItem('table', $row); $content .= self::getCacheItem('field_name', $row); $content .= self::getCacheItem('name', $row); $content .= self::getCacheItem('type', $row); $content .= self::getCacheItem('length', $row, 'int'); $content .= self::getCacheItem('is_null', $row, 'bool'); $content .= self::getCacheItem('is_main', $row, 'bool'); $content .= self::getCacheItem('is_sys', $row, 'bool'); $content .= self::getCacheItem('sort_num', $row, 'int'); $content .= self::getCacheItem('note', $row); $content .= self::getCacheItem('front_status', $row, 'bool'); $content .= self::getCacheItem('front_fun_add', $row); $content .= self::getCacheItem('front_fun_update', $row); $content .= self::getCacheItem('front_fun_show', $row); $content .= self::getCacheItem('front_form_type', $row); $content .= self::getCacheItem('front_form_option', $row); $content .= self::getCacheItem('front_form_default', $row); $content .= self::getCacheItem('front_form_source', $row); $content .= self::getCacheItem('front_form_html', $row); $content .= self::getCacheItem('front_note', $row); $content .= self::getCacheItem('back_status', $row, 'bool'); $content .= self::getCacheItem('back_fun_add', $row); $content .= self::getCacheItem('back_fun_update', $row); $content .= self::getCacheItem('back_fun_show', $row); $content .= self::getCacheItem('back_form_type', $row); $content .= self::getCacheItem('back_form_option', $row); $content .= self::getCacheItem('back_form_default', $row); $content .= self::getCacheItem('back_form_source', $row); $content .= self::getCacheItem('back_form_html', $row); $content .= self::getCacheItem('back_note', $row); $content .= "];" . self::$newLine; } } self::writeFile('cachedFields.php', $content); }