think\console\command\optimize\Schema::buildModelSchema PHP Метод

buildModelSchema() защищенный Метод

protected buildModelSchema ( $class )
    protected function buildModelSchema($class)
    {
        $reflect = new \ReflectionClass($class);
        if (!$reflect->isAbstract() && $reflect->isSubclassOf('\\think\\Model')) {
            $table = $class::getTable();
            $dbName = $class::getConfig('database');
            $content = '<?php ' . PHP_EOL . 'return ';
            $info = $class::getConnection()->getFields($table);
            $content .= var_export($info, true) . ';';
            file_put_contents(RUNTIME_PATH . 'schema' . DS . $dbName . '.' . $table . EXT, $content);
        }
    }