public function setTableName($table)
    {
        // 1. 尝试解析为 [数据库名.表名]
        if(strpos($table, '.') !== false) {
            list($database, $table) = explode('.', $table);
            if ($database)  {
                $this->options['database'] = $database;
                $this->options['real_table_name'] = $table;
            }
        }
        // 2. 尝试分离出命名空间和表名
        else {
            $table = StringHelper::toClassLastName($table, 'model');
        }
        
        $table = StringHelper::toUnderscoreVariable($table);
        if (substr($table, 0, 1) === '#') {
            $this->options['real_table_name'] = $this->options['table_name'] = str_replace('#', '', $table);
        } else {
            $this->options['table_name'] = preg_replace('/^' . static::getTablePrefix() . '/i', '', $table);
        }
        
        return $this;
    }
public function setTableName($table)
    {
        // 1. 尝试解析为 [数据库名.表名]
        if(strpos($table, '.') !== false) {
            list($database, $table) = explode('.', $table);
            if ($database)  {
                $this->options['database'] = $database;
                $this->options['real_table_name'] = $table;
            }
        }
        // 2. 尝试分离出命名空间和表名
        else {
            $table = StringHelper::toClassLastName($table, 'model');
        }
        
        $table = StringHelper::toUnderscoreVariable($table);
        if (substr($table, 0, 1) === '#') {
            $this->options['real_table_name'] = $this->options['table_name'] = str_replace('#', '', $table);
        } else {
            $this->options['table_name'] = preg_replace('/^' . static::getTablePrefix() . '/i', '', $table);
        }
        
        return $this;
    }
public function setTableName ( $ table ) { // 1. 尝试解析为 [数据库名.表名] if ( strpos ( $ table , '.' ) !== false ) { list ( $ database , $ table ) = explode ( '.' , $ table ) ; if ( $ database ) { $ this -> options [ 'database' ] = $ database ; $ this -> options [ 'real_table_name' ] = $ table ; } } // 2. 尝试分离出命名空间和表名 else { $ table = StringHelper :: toClassLastName ( $ table , 'model' ) ; } $ table = StringHelper :: toUnderscoreVariable ( $ table ) ; if ( substr ( $ table , 0 , 1 ) === '#' ) { $ this -> options [ 'real_table_name' ] = $ this -> options [ 'table_name' ] = str_replace ( '#' , '' , $ table ) ; } else { $ this -> options [ 'table_name' ] = preg_replace ( '/^' . static :: getTablePrefix ( ) . '/i' , '' , $ table ) ; } return $ this ; }
set model name.
if options database or table_name is not set, try to set by name.
@param  string $table
@return static
set model name . if options database or table_name is not set try to set by name .