改名
This commit is contained in:
@@ -29,6 +29,7 @@ use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Abstracts\TraitApplication;
|
||||
use Snowflake\Event as SEvent;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
use validator\Validator;
|
||||
@@ -734,16 +735,16 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
||||
}
|
||||
|
||||
if (str_starts_with($table, $tablePrefix)) {
|
||||
return $table;
|
||||
return '`' . static::getDbName() . '`' . $table;
|
||||
} else if (!str_starts_with($table, '{{%')) {
|
||||
return $table;
|
||||
return '`' . static::getDbName() . '`' . $table;
|
||||
}
|
||||
|
||||
$table = trim($table, '{{%}}');
|
||||
if ($tablePrefix) {
|
||||
$table = $tablePrefix . $table;
|
||||
$table = '`' . static::getDbName() . '`' . $tablePrefix . $table;
|
||||
}
|
||||
return $table;
|
||||
return '`' . static::getDbName() . '`' . $table;
|
||||
}
|
||||
|
||||
|
||||
@@ -1045,8 +1046,9 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ConfigException
|
||||
*/
|
||||
public static function getDbName()
|
||||
public static function getDbName(): string
|
||||
{
|
||||
return Config::get('databases.connections.' . static::$ab_name . '.database');
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ trait QueryTrait
|
||||
*/
|
||||
public function getTable(): string
|
||||
{
|
||||
return '`' . $this->modelClass::getDbName() . '`' . $this->modelClass::getTable();
|
||||
return $this->modelClass::getTable();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user