改进模型的字段缓存 虚拟模型不生成字段缓存

This commit is contained in:
thinkphp
2016-09-19 16:13:57 +08:00
parent fb52e8a421
commit 64b4a53de7

View File

@@ -84,12 +84,14 @@ class Schema extends Command
protected function buildModelSchema($class) protected function buildModelSchema($class)
{ {
$table = $class::getTable(); if ($class instanceof \think\Model) {
$dbName = $class::getConfig('database'); $table = $class::getTable();
$content = '<?php ' . PHP_EOL . 'return '; $dbName = $class::getConfig('database');
$info = $class::getConnection()->getFields($table); $content = '<?php ' . PHP_EOL . 'return ';
$content .= var_export($info, true) . ';'; $info = $class::getConnection()->getFields($table);
file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content); $content .= var_export($info, true) . ';';
file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content);
}
} }
protected function buildDataBaseSchema($tables, $db) protected function buildDataBaseSchema($tables, $db)